Skip to content

Commit 99e9bd7

Browse files
committed
MET-23: fix specs
1 parent 974fbb2 commit 99e9bd7

File tree

2 files changed

+22
-81
lines changed

2 files changed

+22
-81
lines changed

spec/AkeneoPimClientSpec.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Akeneo\Pim\ApiClient\Api\FamilyVariantApiInterface;
1616
use Akeneo\Pim\ApiClient\Api\LocaleApiInterface;
1717
use Akeneo\Pim\ApiClient\Api\MeasureFamilyApiInterface;
18+
use Akeneo\Pim\ApiClient\Api\MeasurementFamilyApiInterface;
1819
use Akeneo\Pim\ApiClient\Api\MediaFileApiInterface;
1920
use Akeneo\Pim\ApiClient\Api\ProductApiInterface;
2021
use Akeneo\Pim\ApiClient\Api\ProductModelApiInterface;
@@ -36,6 +37,7 @@ function let(
3637
ChannelApiInterface $channelApi,
3738
CurrencyApiInterface $currencyApi,
3839
MeasureFamilyApiInterface $measureFamilyApi,
40+
MeasurementFamilyApiInterface $measurementFamilyApi,
3941
AssociationTypeApiInterface $associationTypeApi,
4042
FamilyVariantApiInterface $familyVariantApi,
4143
ProductModelApiInterface $productModelApi
@@ -52,6 +54,7 @@ function let(
5254
$channelApi,
5355
$currencyApi,
5456
$measureFamilyApi,
57+
$measurementFamilyApi,
5558
$associationTypeApi,
5659
$familyVariantApi,
5760
$productModelApi

spec/Api/MeasurementFamilyApiSpec.php

Lines changed: 19 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -16,101 +16,39 @@
1616

1717
class MeasurementFamilyApiSpec extends ObjectBehavior
1818
{
19-
function let(
20-
ResourceClientInterface $resourceClient,
21-
PageFactoryInterface $pageFactory,
22-
ResourceCursorFactoryInterface $cursorFactory
23-
) {
24-
$this->beConstructedWith($resourceClient, $pageFactory, $cursorFactory);
19+
function let(ResourceClientInterface $resourceClient) {
20+
$this->beConstructedWith($resourceClient);
2521
}
2622

2723
function it_is_initializable()
2824
{
2925
$this->shouldHaveType(MeasurementFamilyApi::class);
3026
$this->shouldImplement(MeasurementFamilyApiInterface::class);
31-
$this->shouldImplement(ListableResourceInterface::class);
32-
$this->shouldImplement(UpsertableResourceListInterface::class);
3327
}
3428

35-
function it_returns_a_list_of_measure_families_with_default_parameters(
36-
$resourceClient,
37-
$pageFactory,
38-
PageInterface $page
39-
) {
40-
$resourceClient
41-
->getResources(MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI, [], 100, false, [])
42-
->willReturn([]);
43-
44-
$pageFactory->createPage([])->willReturn($page);
45-
46-
$this->listPerPage()->shouldReturn($page);
47-
}
48-
49-
function it_returns_a_list_of_measure_families_with_limit_and_count(
50-
$resourceClient,
51-
$pageFactory,
52-
PageInterface $page
53-
) {
54-
$resourceClient
55-
->getResources(MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI, [], 100, true, [])
56-
->willReturn([]);
57-
58-
$pageFactory->createPage([])->willReturn($page);
59-
60-
$this->listPerPage(100, true)->shouldReturn($page);
61-
}
62-
63-
function it_returns_a_cursor_on_the_list_of_measure_families(
64-
$resourceClient,
65-
$pageFactory,
66-
$cursorFactory,
67-
PageInterface $page,
68-
ResourceCursorInterface $cursor
69-
) {
70-
$resourceClient
71-
->getResources(MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI, [], 100, false, [])
72-
->willReturn([]);
73-
74-
$pageFactory->createPage([])->willReturn($page);
75-
76-
$cursorFactory->createCursor(100, $page)->willReturn($cursor);
77-
78-
$this->all(100, [])->shouldReturn($cursor);
29+
function it_returns_all_measurement_families($resourceClient) {
30+
$resourceClient->getResource(MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI)->willReturn([]);
31+
$this->all()->shouldReturn([]);
7932
}
8033

81-
function it_returns_a_list_of_measure_families_with_additional_query_parameters(
82-
$resourceClient,
83-
$pageFactory,
84-
PageInterface $page
85-
) {
86-
$resourceClient
87-
->getResources(MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI, [], 100, false, ['foo' => 'bar'])
88-
->willReturn([]);
89-
90-
$pageFactory->createPage([])->willReturn($page);
91-
92-
$this->listPerPage(100, false, ['foo' => 'bar'])->shouldReturn($page);
93-
}
94-
95-
function it_upserts_a_list_of_measurement_families($resourceClient, UpsertResourceListResponse $response)
34+
function it_upserts_a_list_of_measurement_families($resourceClient)
9635
{
97-
$resourceClient
98-
->upsertStreamResourceList(
99-
MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI,
100-
[],
101-
[
102-
['code' => 'measurement_family_1'],
103-
['code' => 'measurement_family_2'],
104-
['code' => 'measurement_family_3'],
105-
]
106-
)
107-
->willReturn($response);
36+
$resourceClient->upsertJsonResourceList(
37+
MeasurementFamilyApi::MEASUREMENT_FAMILIES_URI,
38+
[],
39+
[
40+
['code' => 'measurement_family_1'],
41+
['code' => 'measurement_family_2'],
42+
['code' => 'measurement_family_3'],
43+
]
44+
)->willReturn([]);
10845

109-
$this
110-
->upsertList([
46+
$this->upsertList(
47+
[
11148
['code' => 'measurement_family_1'],
11249
['code' => 'measurement_family_2'],
11350
['code' => 'measurement_family_3'],
114-
])->shouldReturn($response);
51+
]
52+
)->shouldReturn([]);
11553
}
11654
}

0 commit comments

Comments
 (0)