$crawler =
$this->
createCrawler($this->
getDoctype().
$html);
$bar =
$crawler->
filter('ul'
);
$output =
$bar->
outerHtml();
$output =
str_replace([' ', "\n"
], '',
$output);
$expected = '<ul><li>1</li><li>2</li><li>3</li></ul>';
$this->
assertSame($expected,
$output);
} public function testNextAll() { $crawler =
$this->
createTestCrawler()->
filterXPath('//li'
)->
eq(1
);
$this->
assertNotSame($crawler,
$crawler->
nextAll(), '->nextAll() returns a new instance of a crawler'
);
$this->
assertInstanceOf(Crawler::
class,
$crawler->
nextAll(), '->nextAll() returns a new instance of a crawler'
);
$nodes =
$crawler->
nextAll();
$this->
assertEquals(1,
$nodes->
count());
$this->
assertEquals('Three',
$nodes->
eq(0
)->
text());
try { $this->
createTestCrawler()->
filterXPath('//ol'
)->
nextAll();
$this->
fail('->nextAll() throws an \InvalidArgumentException if the node list is empty'
);
} catch (\InvalidArgumentException
$e) { $this->
assertTrue(true, '->nextAll() throws an \InvalidArgumentException if the node list is empty'
);
}