22
33namespace Picqer \Tests ;
44
5- use Generator ;
65use PHPUnit \Framework \TestCase ;
76use Picqer \Financials \Exact \Item ;
87use Picqer \Financials \Exact \Query \Resultset ;
@@ -12,7 +11,7 @@ class ModelTest extends TestCase
1211{
1312 use MocksExactConnection;
1413
15- public function testCanFindModel ()
14+ public function testCanFindModel (): void
1615 {
1716 $ handler = $ this ->createMockHandlerUsingFixture ('item.json ' );
1817 $ connection = $ this ->createMockConnection ($ handler );
@@ -23,7 +22,7 @@ public function testCanFindModel()
2322 $ this ->assertEquals ('00000000-0000-0000-0000-000000000000 ' , $ response ->primaryKeyContent ());
2423 }
2524
26- public function testCanGetFirstModel ()
25+ public function testCanGetFirstModel (): void
2726 {
2827 $ handler = $ this ->createMockHandlerUsingFixture ('item.json ' );
2928 $ connection = $ this ->createMockConnection ($ handler );
@@ -34,7 +33,7 @@ public function testCanGetFirstModel()
3433 $ this ->assertEquals ('00000000-0000-0000-0000-000000000000 ' , $ response ->primaryKeyContent ());
3534 }
3635
37- public function testCanGetModels ()
36+ public function testCanGetModels (): void
3837 {
3938 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
4039 $ connection = $ this ->createMockConnection ($ handler );
@@ -46,18 +45,17 @@ public function testCanGetModels()
4645 $ this ->assertCount (2 , $ response );
4746 }
4847
49- public function testCanGetModelsAsGenerator ()
48+ public function testCanGetModelsAsGenerator (): void
5049 {
5150 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
5251 $ connection = $ this ->createMockConnection ($ handler );
5352
5453 $ response = (new Item ($ connection ))->getAsGenerator ();
5554
56- $ this ->assertInstanceOf (Generator::class, $ response );
57- $ this ->assertCount (2 , $ response );
55+ $ this ->assertEquals (2 , iterator_count ($ response ));
5856 }
5957
60- public function testCanFilterModels ()
58+ public function testCanFilterModels (): void
6159 {
6260 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
6361 $ connection = $ this ->createMockConnection ($ handler );
@@ -69,18 +67,17 @@ public function testCanFilterModels()
6967 $ this ->assertCount (2 , $ response );
7068 }
7169
72- public function testCanFilterModelsAsGenerator ()
70+ public function testCanFilterModelsAsGenerator (): void
7371 {
7472 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
7573 $ connection = $ this ->createMockConnection ($ handler );
7674
7775 $ response = (new Item ($ connection ))->filterAsGenerator ('IsWebshopItem eq 0 ' );
7876
79- $ this ->assertInstanceOf (Generator::class, $ response );
80- $ this ->assertCount (2 , $ response );
77+ $ this ->assertEquals (2 , iterator_count ($ response ));
8178 }
8279
83- public function testCanGetCollectionFromResult ()
80+ public function testCanGetCollectionFromResult (): void
8481 {
8582 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
8683 $ connection = $ this ->createMockConnection ($ handler );
@@ -94,7 +91,7 @@ public function testCanGetCollectionFromResult()
9491 $ this ->assertCount (2 , $ collection );
9592 }
9693
97- public function testCanGetCollectionFromResultAsGenerator ()
94+ public function testCanGetCollectionFromResultAsGenerator (): void
9895 {
9996 $ handler = $ this ->createMockHandlerUsingFixture ('items.json ' );
10097 $ connection = $ this ->createMockConnection ($ handler );
@@ -103,18 +100,16 @@ public function testCanGetCollectionFromResultAsGenerator()
103100 $ result = $ connection ->get ($ item ->url (), []);
104101 $ collection = $ item ->collectionFromResultAsGenerator ($ result );
105102
106- $ this ->assertInstanceOf (Generator::class, $ collection );
107- $ this ->assertCount (2 , $ collection );
103+ $ this ->assertEquals (2 , iterator_count ($ collection ));
108104 }
109105
110- public function testCanGetResultSet ()
106+ public function testCanGetResultSet (): void
111107 {
112108 $ handler = $ this ->createMockHandler ();
113109 $ connection = $ this ->createMockConnection ($ handler );
114- $ item = new Item ($ connection );
115110
116- $ resultset = (new Item ($ connection ))->getResultSet ();
111+ $ resultSet = (new Item ($ connection ))->getResultSet ();
117112
118- $ this ->assertInstanceOf (Resultset::class, $ resultset );
113+ $ this ->assertInstanceOf (Resultset::class, $ resultSet );
119114 }
120115}
0 commit comments