Skip to content

Commit dc1b2fc

Browse files
committed
refactor: upgrade test suite to current standards withing the constraints of phpunit version
1 parent b7ecb61 commit dc1b2fc

File tree

5 files changed

+198
-205
lines changed

5 files changed

+198
-205
lines changed

tests/ConnectionTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,11 @@ public function testResponseIsLoggedIfAcquiringTokensFailed(): void
8989
$connection->get('crm/Accounts');
9090
}
9191

92-
public function endpointsThatDontUseDivisionInUrl(): array
92+
public function endpointsThatDontUseDivisionInUrl(): \Generator
9393
{
94-
return [
95-
'System users endpoint' => ['system/Users'],
96-
'Me endpoint' => ['current/Me'],
97-
];
94+
95+
yield 'System users endpoint' => ['system/Users'];
96+
yield 'Me endpoint' => ['current/Me'];
9897
}
9998

10099
private function createMockHandler(): MockHandler

tests/ModelTest.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ModelTest extends TestCase
1212
{
1313
use MocksExactConnection;
1414

15-
public function testCanFindModel()
15+
public function testCanFindModel(): void
1616
{
1717
$handler = $this->createMockHandlerUsingFixture('item.json');
1818
$connection = $this->createMockConnection($handler);
@@ -23,7 +23,7 @@ public function testCanFindModel()
2323
$this->assertEquals('00000000-0000-0000-0000-000000000000', $response->primaryKeyContent());
2424
}
2525

26-
public function testCanGetFirstModel()
26+
public function testCanGetFirstModel(): void
2727
{
2828
$handler = $this->createMockHandlerUsingFixture('item.json');
2929
$connection = $this->createMockConnection($handler);
@@ -34,7 +34,7 @@ public function testCanGetFirstModel()
3434
$this->assertEquals('00000000-0000-0000-0000-000000000000', $response->primaryKeyContent());
3535
}
3636

37-
public function testCanGetModels()
37+
public function testCanGetModels(): void
3838
{
3939
$handler = $this->createMockHandlerUsingFixture('items.json');
4040
$connection = $this->createMockConnection($handler);
@@ -46,18 +46,17 @@ public function testCanGetModels()
4646
$this->assertCount(2, $response);
4747
}
4848

49-
public function testCanGetModelsAsGenerator()
49+
public function testCanGetModelsAsGenerator(): void
5050
{
5151
$handler = $this->createMockHandlerUsingFixture('items.json');
5252
$connection = $this->createMockConnection($handler);
5353

5454
$response = (new Item($connection))->getAsGenerator();
5555

56-
$this->assertInstanceOf(Generator::class, $response);
5756
$this->assertEquals(2, iterator_count($response));
5857
}
5958

60-
public function testCanFilterModels()
59+
public function testCanFilterModels(): void
6160
{
6261
$handler = $this->createMockHandlerUsingFixture('items.json');
6362
$connection = $this->createMockConnection($handler);
@@ -69,18 +68,17 @@ public function testCanFilterModels()
6968
$this->assertCount(2, $response);
7069
}
7170

72-
public function testCanFilterModelsAsGenerator()
71+
public function testCanFilterModelsAsGenerator(): void
7372
{
7473
$handler = $this->createMockHandlerUsingFixture('items.json');
7574
$connection = $this->createMockConnection($handler);
7675

7776
$response = (new Item($connection))->filterAsGenerator('IsWebshopItem eq 0');
7877

79-
$this->assertInstanceOf(Generator::class, $response);
8078
$this->assertEquals(2, iterator_count($response));
8179
}
8280

83-
public function testCanGetCollectionFromResult()
81+
public function testCanGetCollectionFromResult(): void
8482
{
8583
$handler = $this->createMockHandlerUsingFixture('items.json');
8684
$connection = $this->createMockConnection($handler);
@@ -94,7 +92,7 @@ public function testCanGetCollectionFromResult()
9492
$this->assertCount(2, $collection);
9593
}
9694

97-
public function testCanGetCollectionFromResultAsGenerator()
95+
public function testCanGetCollectionFromResultAsGenerator(): void
9896
{
9997
$handler = $this->createMockHandlerUsingFixture('items.json');
10098
$connection = $this->createMockConnection($handler);
@@ -103,18 +101,16 @@ public function testCanGetCollectionFromResultAsGenerator()
103101
$result = $connection->get($item->url(), []);
104102
$collection = $item->collectionFromResultAsGenerator($result);
105103

106-
$this->assertInstanceOf(Generator::class, $collection);
107104
$this->assertEquals(2, iterator_count($collection));
108105
}
109106

110-
public function testCanGetResultSet()
107+
public function testCanGetResultSet(): void
111108
{
112109
$handler = $this->createMockHandler();
113110
$connection = $this->createMockConnection($handler);
114-
$item = new Item($connection);
115111

116-
$resultset = (new Item($connection))->getResultSet();
112+
$resultSet = (new Item($connection))->getResultSet();
117113

118-
$this->assertInstanceOf(Resultset::class, $resultset);
114+
$this->assertInstanceOf(Resultset::class, $resultSet);
119115
}
120116
}

0 commit comments

Comments
 (0)