Skip to content

Commit 13f6308

Browse files
committed
Fix tests for phpunit 8
1 parent 92dfd5b commit 13f6308

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

phpunit.xml.dist

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
convertNoticesToExceptions="true"
99
convertWarningsToExceptions="true"
1010
processIsolation="false"
11-
stopOnFailure="false"
12-
syntaxCheck="false">
11+
stopOnFailure="false">
1312

14-
<testsuite>
13+
<testsuite name="Integration">
1514
<directory>tests/</directory>
1615
</testsuite>
1716

tests/Api/ApiTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class ApiTestCase extends TestCase
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
protected function setUp()
26+
protected function setUp(): void
2727
{
2828
$this->server = new MockWebServer(8081, '127.0.0.1');
2929
$this->server->start();
@@ -39,7 +39,7 @@ protected function setUp()
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
protected function tearDown()
42+
protected function tearDown(): void
4343
{
4444
$this->server->stop();
4545
}

tests/Api/CreateProductTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,18 @@ public function test_create_product()
2727
Assert::assertSame(201, $response);
2828
}
2929

30-
/**
31-
* @expectedException \Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException
32-
* @expectedExceptionMessage The value black_sneakers is already set on another product for the unique attribute sku
33-
*/
3430
public function test_create_invalid_product()
3531
{
3632
$this->server->setResponseOfPath(
3733
'/'. ProductApi::PRODUCTS_URI,
3834
new ResponseStack(
3935
new Response('{"code": 422, "message":"The value black_sneakers is already set on another product for the unique attribute sku"}', [], 422)
40-
)
41-
);
42-
36+
)
37+
);
38+
39+
$this->expectException(\Akeneo\Pim\ApiClient\Exception\UnprocessableEntityHttpException::class);
40+
$this->expectExceptionMessage('The value black_sneakers is already set on another product for the unique attribute sku');
41+
4342
$api = $this->createClient()->getProductApi();
4443
$api->create('black_sneakers', $this->newProduct());
4544
}

tests/Api/GetProductTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ public function test_get_product()
2727
Assert::assertEquals($product, json_decode($this->getProduct(), true));
2828
}
2929

30-
/**
31-
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
32-
* @expectedExceptionMessage Resource `black_sneakers` does not exist.
33-
*/
3430
public function test_get_unknow_product()
3531
{
3632
$this->server->setResponseOfPath(
@@ -40,6 +36,9 @@ public function test_get_unknow_product()
4036
)
4137
);
4238

39+
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
40+
$this->expectExceptionMessage('Resource `black_sneakers` does not exist.');
41+
4342
$api = $this->createClient()->getProductApi();
4443
$api->get('black_sneakers');
4544
}

tests/Api/UpsertListProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class UpsertListProductTest extends ApiTestCase
1414
{
15-
public function setUp()
15+
public function setUp(): void
1616
{
1717
parent::setUp();
1818
$this->server->setResponseOfPath(

0 commit comments

Comments
 (0)