@@ -20,7 +20,10 @@ public function testConstructor()
20
20
$ crawler = new Crawler ();
21
21
$ this ->assertCount (0 , $ crawler , '__construct() returns an empty crawler ' );
22
22
23
- $ crawler = new Crawler (new \DOMNode ());
23
+ $ doc = new \DOMDocument ();
24
+ $ node = $ doc ->createElement ('test ' );
25
+
26
+ $ crawler = new Crawler ($ node );
24
27
$ this ->assertCount (1 , $ crawler , '__construct() takes a node as a first argument ' );
25
28
}
26
29
@@ -71,6 +74,14 @@ public function testAddHtmlContent()
71
74
$ crawler ->addHtmlContent ('<html><div class="foo"></html> ' , 'UTF-8 ' );
72
75
73
76
$ this ->assertEquals ('foo ' , $ crawler ->filterXPath ('//div ' )->attr ('class ' ), '->addHtmlContent() adds nodes from an HTML string ' );
77
+ }
78
+
79
+ /**
80
+ * @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent
81
+ */
82
+ public function testAddHtmlContentWithBaseTag ()
83
+ {
84
+ $ crawler = new Crawler ();
74
85
75
86
$ crawler ->addHtmlContent ('<html><head><base href="http://symfony.com"></head><a href="/contact"></a></html> ' , 'UTF-8 ' );
76
87
@@ -267,6 +278,7 @@ public function testAddNodeList()
267
278
*/
268
279
public function testAddNodes ()
269
280
{
281
+ $ list = array ();
270
282
foreach ($ this ->createNodeList () as $ node ) {
271
283
$ list [] = $ node ;
272
284
}
@@ -290,7 +302,10 @@ public function testAddNode()
290
302
291
303
public function testClear ()
292
304
{
293
- $ crawler = new Crawler (new \DOMNode ());
305
+ $ doc = new \DOMDocument ();
306
+ $ node = $ doc ->createElement ('test ' );
307
+
308
+ $ crawler = new Crawler ($ node );
294
309
$ crawler ->clear ();
295
310
$ this ->assertCount (0 , $ crawler , '->clear() removes all the nodes from the crawler ' );
296
311
}
0 commit comments