Skip to content

Commit d8b13fe

Browse files
author
Samuel Gomis
committed
fix(): PR comments
1 parent 33b360c commit d8b13fe

13 files changed

+91
-77
lines changed

tests/Api/ApiTestCase.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ protected function tearDown(): void
4343
$this->server->stop();
4444
}
4545

46-
/**
47-
* @return AkeneoPimClientInterface
48-
*/
4946
protected function createClientByPassword(): AkeneoPimClientInterface
5047
{
5148
$clientBuilder = new AkeneoPimClientBuilder($this->server->getServerRoot());

tests/Api/Asset/GetAssetIntegration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function test_get_asset()
2525
$api = $this->createClientByPassword()->getAssetManagerApi();
2626
$asset = $api->get('packshot', 'battleship');
2727

28-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
28+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
2929
Assert::assertEquals($asset, json_decode($this->getAsset(), true));
3030
}
3131

tests/Api/AssetAttribute/GetAssetFamilyAttributeIntegration.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public function test_get_asset_family_attribute()
2525
$api = $this->createClientByPassword()->getAssetAttributeApi();
2626
$familyAttribute = $api->get('packshot', 'media_preview');
2727

28-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
28+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
2929
Assert::assertEquals($familyAttribute, json_decode($this->getPackshotPreviewAttribute(), true));
3030
}
3131

32+
/**
33+
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
34+
* @expectedExceptionMessage Resource `foo` does not exist.
35+
*/
3236
public function test_get_unknown_asset_family_attribute()
3337
{
34-
$this->expectExceptionMessage("Resource `foo` does not exist.");
35-
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
3638
$this->server->setResponseOfPath(
3739
'/'. sprintf(AssetAttributeApi::ASSET_ATTRIBUTE_URI, 'packshot', 'foo'),
3840
new ResponseStack(

tests/Api/AssetAttribute/ListAllAssetFamilyAttributesIntegration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function test_list_family_attributes()
2525
$api = $this->createClientByPassword()->getAssetAttributeApi();
2626
$assetFamilyAttributes = $api->all('packshot');
2727

28-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
28+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
2929
Assert::assertEquals($assetFamilyAttributes, json_decode($this->getAssetFamilyAttributes(), true));
3030
}
3131

tests/Api/AssetAttributeOption/GetAssetFamilyAttributeOptionIntegration.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public function test_get_asset_family_attribute_option()
2525
$api = $this->createClientByPassword()->getAssetAttributeOptionApi();
2626
$familyAttributeOption = $api->get('packshot', 'wearing_model_size', 'small');
2727

28-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
28+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
2929
Assert::assertEquals($familyAttributeOption, json_decode($this->getPackshotAttributeOption(), true));
3030
}
3131

32+
/**
33+
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
34+
* @expectedExceptionMessage Resource `XLS` does not exist.
35+
*/
3236
public function test_get_unknown_asset_family_attribute_option()
3337
{
34-
$this->expectExceptionMessage("Resource `XLS` does not exist.");
35-
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
3638
$this->server->setResponseOfPath(
3739
'/'. sprintf(AssetAttributeOptionApi::ASSET_ATTRIBUTE_OPTION_URI, 'packshot', 'wearing_model_size', 'XLS'),
3840
new ResponseStack(

tests/Api/AssetAttributeOption/ListAllAssetFamilyAttributeOptionsIntegration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function test_list_family_attribute_options()
2929
$api = $this->createClientByPassword()->getAssetAttributeOptionApi();
3030
$assetFamilyAttributeOptions = $api->all('packshot', 'wearing_model_size');
3131

32-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
32+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
3333
Assert::assertEquals($assetFamilyAttributeOptions, json_decode($this->getAssetFamilyAttributeOptions(), true));
3434
}
3535

tests/Api/AssetFamily/GetAssetFamilyIntegration.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ public function test_get_asset_family()
2525
$api = $this->createClientByPassword()->getAssetFamilyApi();
2626
$product = $api->get('packshot');
2727

28-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
28+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
2929
Assert::assertEquals($product, json_decode($this->getPackshot(), true));
3030
}
3131

32+
/**
33+
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
34+
* @expectedExceptionMessage Asset family "foo" does not exist.
35+
*/
3236
public function test_get_unknown_asset_family()
3337
{
34-
$this->expectExceptionMessage("Asset family \"foo\" does not exist.");
35-
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
3638
$this->server->setResponseOfPath(
3739
'/'. sprintf(AssetFamilyApi::ASSET_FAMILY_URI, 'foo'),
3840
new ResponseStack(

tests/Api/AssetFamily/ListAllAssetFamiliesIntegration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ListAllAssetFamiliesIntegration extends ApiTestCase
1515
public function test_list_per_page()
1616
{
1717
$this->server->setResponseOfPath(
18-
'/' . AssetFamilyApi::ASSET_FAMILIES_URI,
18+
'/' . sprintf(AssetFamilyApi::ASSET_FAMILIES_URI),
1919
new ResponseStack(
2020
new Response($this->getFirstPage(), [], 200),
2121
new Response($this->getSecondPage(), [], 200)

tests/Api/AssetMediaFile/CreateAssetMediaFileIntegration.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public function test_create_asset_media_file()
2424

2525
Assert::assertNotEmpty($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']);
2626
Assert::assertSame(
27-
'unicorn.png',
28-
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['name']
27+
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['name'],
28+
'unicorn.png'
2929
);
3030
Assert::assertSame(
31-
'image/png',
32-
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['type']
31+
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['type'],
32+
'image/png'
3333
);
3434
Assert::assertSame(
35-
11255,
36-
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['size']
35+
$this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_FILES]['file']['size'],
36+
11255
3737
);
3838
Assert::assertSame('my-asset-media-code', $response);
3939
}

tests/Api/AssetReferenceFile/DownloadAssetReferenceFileIntegration.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function test_download_a_localizable_asset_reference_file()
2626
$api = $this->createClientByPassword()->getAssetReferenceFileApi();
2727
$downloadResponse = $api->downloadFromLocalizableAsset('ziggy', 'en_US');
2828

29-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
29+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
3030

3131
Assert::assertInstanceOf(ResponseInterface::class, $downloadResponse);
3232
Assert::assertSame(file_get_contents($expectedFilePath), $downloadResponse->getBody()->getContents());
@@ -46,15 +46,17 @@ public function test_download_a_not_localizable_asset_reference_file()
4646
$api = $this->createClientByPassword()->getAssetReferenceFileApi();
4747
$downloadResponse = $api->downloadFromNotLocalizableAsset('ziggy_certif');
4848

49-
Assert::assertSame('GET', $this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD]);
49+
Assert::assertSame($this->server->getLastRequest()->jsonSerialize()[RequestInfo::JSON_KEY_METHOD], 'GET');
5050

5151
$this->assertInstanceOf(ResponseInterface::class, $downloadResponse);
5252
Assert::assertSame(file_get_contents($expectedFilePath), $downloadResponse->getBody()->getContents());
5353
}
5454

55+
/**
56+
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
57+
*/
5558
public function test_download_from_localizable_asset_not_found()
5659
{
57-
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
5860
$this->server->setResponseOfPath(
5961
'/'. sprintf(AssetReferenceFileApi::ASSET_REFERENCE_FILE_DOWNLOAD_URI, 'ziggy', 'en_US'),
6062
new ResponseStack(
@@ -66,9 +68,11 @@ public function test_download_from_localizable_asset_not_found()
6668
$api->downloadFromLocalizableAsset('ziggy', 'en_US');
6769
}
6870

71+
/**
72+
* @expectedException \Akeneo\Pim\ApiClient\Exception\NotFoundHttpException
73+
*/
6974
public function test_download_from_not_localizable_asset_not_found()
7075
{
71-
$this->expectException(\Akeneo\Pim\ApiClient\Exception\NotFoundHttpException::class);
7276
$this->server->setResponseOfPath(
7377
'/'. sprintf(AssetReferenceFileApi::ASSET_REFERENCE_FILE_DOWNLOAD_URI, 'ziggy_certif', AssetReferenceFileApi::NOT_LOCALIZABLE_ASSET_LOCALE_CODE),
7478
new ResponseStack(

0 commit comments

Comments
 (0)