1111
1212class CollectionTest extends TestCase
1313{
14- public function testEach ()
14+ public function testEach (): void
1515 {
1616 $ root = new HtmlNode (new Tag ('root ' ));
1717 $ parent = new HtmlNode (new Tag ('div ' ));
@@ -32,23 +32,21 @@ public function testEach()
3232 $ this ->assertEquals (2 , $ count );
3333 }
3434
35- /**
36- * @expectedException \PHPHtmlParser\Exceptions\EmptyCollectionException
37- */
38- public function testCallNoNodes ()
35+ public function testCallNoNodes (): void
3936 {
4037 $ collection = new Collection ();
38+ $ this ->expectException (\PHPHtmlParser \Exceptions \EmptyCollectionException::class);
4139 $ collection ->innerHtml ();
4240 }
4341
44- public function testNoNodeString ()
42+ public function testNoNodeString (): void
4543 {
4644 $ collection = new Collection ();
4745 $ string = (string ) $ collection ;
4846 $ this ->assertEmpty ($ string );
4947 }
5048
51- public function testCallMagic ()
49+ public function testCallMagic (): void
5250 {
5351 $ root = new HtmlNode (new Tag ('root ' ));
5452 $ parent = new HtmlNode (new Tag ('div ' ));
@@ -64,7 +62,7 @@ public function testCallMagic()
6462 $ this ->assertEquals ($ child3 ->id (), $ selector ->find ($ root )->id ());
6563 }
6664
67- public function testGetMagic ()
65+ public function testGetMagic (): void
6866 {
6967 $ root = new HtmlNode (new Tag ('root ' ));
7068 $ parent = new HtmlNode (new Tag ('div ' ));
@@ -80,16 +78,14 @@ public function testGetMagic()
8078 $ this ->assertEquals ($ child3 ->innerHtml , $ selector ->find ($ root )->innerHtml );
8179 }
8280
83- /**
84- * @expectedException \PHPHtmlParser\Exceptions\EmptyCollectionException
85- */
86- public function testGetNoNodes ()
81+ public function testGetNoNodes (): void
8782 {
8883 $ collection = new Collection ();
84+ $ this ->expectException (\PHPHtmlParser \Exceptions \EmptyCollectionException::class);
8985 $ collection ->innerHtml ;
9086 }
9187
92- public function testToStringMagic ()
88+ public function testToStringMagic (): void
9389 {
9490 $ root = new HtmlNode (new Tag ('root ' ));
9591 $ parent = new HtmlNode (new Tag ('div ' ));
@@ -105,7 +101,7 @@ public function testToStringMagic()
105101 $ this ->assertEquals ((string ) $ child3 , (string ) $ selector ->find ($ root ));
106102 }
107103
108- public function testToArray ()
104+ public function testToArray (): void
109105 {
110106 $ root = new HtmlNode (new Tag ('root ' ));
111107 $ parent = new HtmlNode (new Tag ('div ' ));
@@ -124,21 +120,21 @@ public function testToArray()
124120 $ this ->assertEquals ($ child3 ->id (), $ lastA ->id ());
125121 }
126122
127- public function testGetIterator ()
123+ public function testGetIterator (): void
128124 {
129125 $ collection = new Collection ();
130126 $ iterator = $ collection ->getIterator ();
131127 $ this ->assertTrue ($ iterator instanceof \ArrayIterator);
132128 }
133129
134- public function testOffsetSet ()
130+ public function testOffsetSet (): void
135131 {
136132 $ collection = new Collection ();
137133 $ collection ->offsetSet (7 , true );
138134 $ this ->assertTrue ($ collection ->offsetGet (7 ));
139135 }
140136
141- public function testOffsetUnset ()
137+ public function testOffsetUnset (): void
142138 {
143139 $ collection = new Collection ();
144140 $ collection ->offsetSet (7 , true );
0 commit comments