Skip to content

Commit 712edb4

Browse files
authored
Merge pull request #668 from DannyvdSluijs/Upgrade-phpunit
Upgrade phpunit
2 parents 14ab3a4 + 26822ea commit 712edb4

File tree

7 files changed

+215
-221
lines changed

7 files changed

+215
-221
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"ext-json": "*"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^8.5|^9.3"
24+
"phpunit/phpunit": "^9.6"
2525
},
2626
"autoload": {
2727
"psr-4": {

phpunit.xml.dist

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
bootstrap="./vendor/autoload.php"
4-
colors="true"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="./vendor/autoload.php"
5+
colors="true"
6+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd">
7+
8+
<coverage>
9+
<include>
10+
<directory suffix=".php">src</directory>
11+
</include>
12+
</coverage>
13+
614
<testsuites>
7-
<testsuite name="Application Test Suite">
15+
<testsuite name="Exact PHP Client Test Suite">
816
<directory>tests</directory>
917
</testsuite>
1018
</testsuites>
11-
<filter>
12-
<whitelist>
13-
<directory suffix=".php">src</directory>
14-
</whitelist>
15-
</filter>
1619
</phpunit>

tests/ConnectionTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ 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+
yield 'System users endpoint' => ['system/Users'];
95+
yield 'Me endpoint' => ['current/Me'];
9896
}
9997

10098
private function createMockHandler(): MockHandler

tests/ModelTest.php

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Picqer\Tests;
44

5-
use Generator;
65
use PHPUnit\Framework\TestCase;
76
use Picqer\Financials\Exact\Item;
87
use 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

Comments
 (0)