Passed
Push — master ( 69b252...c02560 )
by
unknown
56s queued 11s
created

IsmpApiTest::provideTestAuthCertData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lamoda\IsmpClient\Tests\V4;
6
7
use GuzzleHttp\ClientInterface;
8
use GuzzleHttp\Exception\BadResponseException;
9
use GuzzleHttp\Psr7\Response;
10
use GuzzleHttp\RequestOptions;
11
use Lamoda\IsmpClient\Exception\IsmpGeneralErrorException;
12
use Lamoda\IsmpClient\Exception\IsmpRequestErrorException;
13
use Lamoda\IsmpClient\Serializer\SerializerInterface;
14
use Lamoda\IsmpClient\V3\Dto\AuthCertKeyResponse;
15
use Lamoda\IsmpClient\V3\Dto\AuthCertRequest;
16
use Lamoda\IsmpClient\V3\Dto\AuthCertResponse;
17
use Lamoda\IsmpClient\V3\Dto\DocumentCreateRequest;
18
use Lamoda\IsmpClient\V4\Dto\FacadeCisListRequest;
19
use Lamoda\IsmpClient\V4\Dto\FacadeCisListResponse;
20
use Lamoda\IsmpClient\V4\Dto\FacadeDocBodyResponse;
21
use Lamoda\IsmpClient\V3\Dto\FacadeDocListV2Query;
22
use Lamoda\IsmpClient\V3\Dto\FacadeDocListV2Response;
23
use Lamoda\IsmpClient\V3\Dto\ProductInfoResponse;
24
use Lamoda\IsmpClient\V3\Enum\DocumentLkType;
25
use Lamoda\IsmpClient\V3\Enum\ProductGroup;
26
use Lamoda\IsmpClient\V4\IsmpApi;
27
use PHPUnit\Framework\MockObject\MockObject;
28
use PHPUnit\Framework\TestCase;
29
use Psr\Http\Message\RequestInterface;
30
31
use function GuzzleHttp\Psr7\stream_for;
32
33
final class IsmpApiTest extends TestCase
34
{
35
    private const TOKEN = '0a893bdc-3127-4f3f-939e-f423d08d9bd6';
36
    private const UUID = '81497c0c-17ef-42a1-b1d1-d769dac7441c';
37
    private const RANDOM_DATA = '2b212c99-9955-45c7-8594-9d3aa59eae04';
38
    private const SERIALIZED_VALUE = '{"test:"value"}';
39
    private const API_RESPONSE = 'stub_api_response';
40
    private const IDENTITY = 'eb852349-647f-468f-bb90-d26a4d975a88';
41
42
    /**
43
     * @var ClientInterface|MockObject
44
     */
45
    private $client;
46
    /**
47
     * @var SerializerInterface|MockObject
48
     */
49
    private $serializer;
50
    /**
51
     * @var IsmpApi
52
     */
53
    private $api;
54
55
    protected function setUp(): void
56
    {
57
        $this->client = $this->createMock(ClientInterface::class);
58
        $this->serializer = $this->createMock(SerializerInterface::class);
59
60
        $this->api = new IsmpApi(
61
            $this->client,
0 ignored issues
show
Documentation introduced by
$this->client is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<GuzzleHttp\ClientInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
62
            $this->serializer
0 ignored issues
show
Documentation introduced by
$this->serializer is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Lamoda\IsmpClient...er\SerializerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
63
        );
64
    }
65
66
    public function testExceptionWithHttpCode(): void
67
    {
68
        $this->client
69
            ->method('request')
70
            ->willThrowException(new BadResponseException('Bad response', $this->createMock(RequestInterface::class)));
0 ignored issues
show
Documentation introduced by
$this->createMock(\Psr\H...equestInterface::class) is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Psr\Http\Message\RequestInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
72
        $this->expectException(IsmpRequestErrorException::class);
73
        $this->api->authCertKey();
74
    }
75
76
    public function testGeneralException(): void
77
    {
78
        $this->client
79
            ->method('request')
80
            ->willThrowException(new \RuntimeException());
81
82
        $this->expectException(IsmpGeneralErrorException::class);
83
        $this->api->authCertKey();
84
    }
85
86
    public function testAuthCertKey(): void
87
    {
88
        $expectedResult = new AuthCertKeyResponse(self::UUID, self::RANDOM_DATA);
89
90
        $this->serializer
91
            ->method('deserialize')
92
            ->with(
93
                get_class($expectedResult),
94
                self::API_RESPONSE
95
            )
96
            ->willReturn($expectedResult);
97
98
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
99
            ->method('request')
100
            ->with(
101
                'GET',
102
                'api/v3/auth/cert/key',
103
                [
104
                    RequestOptions::BODY => null,
105
                    RequestOptions::HEADERS => [
106
                        'Content-Type' => 'application/json',
107
                    ],
108
                    RequestOptions::HTTP_ERRORS => true,
109
                    RequestOptions::QUERY => null,
110
                ]
111
            )
112
            ->willReturn(
113
                (new Response())
114
                    ->withBody(stream_for(self::API_RESPONSE))
115
            );
116
117
        $result = $this->api->authCertKey();
118
119
        $this->assertEquals($expectedResult, $result);
120
    }
121
122
    /**
123
     * @dataProvider provideTestAuthCertData
124
     * @param AuthCertRequest $request
125
     * @param string|null $connection
126
     * @param AuthCertResponse $expectedResult
127
     */
128
    public function testAuthCert(
129
        AuthCertRequest $request,
130
        ?string $connection,
131
        AuthCertResponse $expectedResult
132
    ): void {
133
        $this->serializer
134
            ->method('serialize')
135
            ->with($request)
136
            ->willReturn(self::SERIALIZED_VALUE);
137
138
        $this->serializer
139
            ->method('deserialize')
140
            ->with(
141
                get_class($expectedResult),
142
                self::API_RESPONSE
143
            )
144
            ->willReturn($expectedResult);
145
146
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
147
            ->method('request')
148
            ->with(
149
                'POST',
150
                sprintf('api/v3/auth/cert/%s', $connection),
151
                [
152
                    RequestOptions::BODY => self::SERIALIZED_VALUE,
153
                    RequestOptions::HEADERS => [
154
                        'Content-Type' => 'application/json',
155
                    ],
156
                    RequestOptions::HTTP_ERRORS => true,
157
                    RequestOptions::QUERY => null,
158
                ]
159
            )
160
            ->willReturn(
161
                (new Response())
162
                    ->withBody(stream_for(self::API_RESPONSE))
163
            );
164
165
        $result = $this->api->authCert($request, $connection);
166
167
        $this->assertEquals($expectedResult, $result);
168
    }
169
170
    public function provideTestAuthCertData(): iterable
171
    {
172
        yield 'Without connection' => [
173
            $request = new AuthCertRequest(self::UUID, self::RANDOM_DATA),
174
            null,
175
            $response = new AuthCertResponse('token-value')
176
        ];
177
178
        yield 'With connection' => [
179
            $request,
180
            'connection',
181
            $response
182
        ];
183
    }
184
185
    public function testFacadeDocListV2(): void
186
    {
187
        $query = new FacadeDocListV2Query();
188
        $query->setDocumentStatus(FacadeDocListV2Query::DOCUMENT_STATUS_CHECKED_OK);
189
        $query->setDateFrom(new \DateTimeImmutable('2019-01-01 11:12:13', new \DateTimeZone('UTC')));
190
        $expectedResult = new FacadeDocListV2Response(0);
191
192
        $this->serializer
193
            ->method('deserialize')
194
            ->with(
195
                get_class($expectedResult),
196
                self::API_RESPONSE
197
            )
198
            ->willReturn($expectedResult);
199
200
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
201
            ->method('request')
202
            ->with(
203
                'GET',
204
                'api/v3/facade/doc/listV2',
205
                [
206
                    RequestOptions::BODY => null,
207
                    RequestOptions::HEADERS => [
208
                        'Content-Type' => 'application/json',
209
                        'Authorization' => 'Bearer ' . self::TOKEN,
210
                    ],
211
                    RequestOptions::HTTP_ERRORS => true,
212
                    RequestOptions::QUERY => [
213
                        'documentStatus' => FacadeDocListV2Query::DOCUMENT_STATUS_CHECKED_OK,
214
                        'dateFrom' => '2019-01-01T11:12:13.000+00:00',
215
                        'limit' => $query->getLimit(),
216
                    ],
217
                ]
218
            )
219
            ->willReturn(
220
                (new Response())
221
                    ->withBody(stream_for(self::API_RESPONSE))
222
            );
223
224
        $result = $this->api->facadeDocListV2(self::TOKEN, $query);
225
226
        $this->assertEquals($expectedResult, $result);
227
    }
228
229
    /**
230
     * @dataProvider provideTestFacadeDocBodyData
231
     */
232
    public function testFacadeDocBody(
233
        ?int $limitOption,
234
        ?string $orderColumnOption,
235
        ?string $orderedColumnValueOption,
236
        ?string $pageDirOption,
237
        array $expectedOptions
238
    ): void {
239
        $expectedResult = new FacadeDocBodyResponse(self::IDENTITY, '2019-01-01', 'IMPORT', 'NEW', 'Tester', 'Test');
240
        $expectedResult->setCisTotal('100');
241
242
        $this->serializer
243
            ->method('deserialize')
244
            ->with(
245
                get_class($expectedResult),
246
                self::API_RESPONSE
247
            )
248
            ->willReturn($expectedResult);
249
250
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
251
            ->method('request')
252
            ->with(
253
                'GET',
254
                sprintf('api/v4/facade/doc/%s/body', self::IDENTITY),
255
                $expectedOptions
256
            )
257
            ->willReturn(
258
                (new Response())
259
                    ->withBody(stream_for(self::API_RESPONSE))
260
            );
261
262
        $result = $this->api->facadeDocBody(
263
            self::TOKEN,
264
            self::IDENTITY,
265
            $limitOption,
266
            $orderColumnOption,
267
            $orderedColumnValueOption,
268
            $pageDirOption
269
        );
270
271
        $this->assertEquals($expectedResult, $result);
272
    }
273
274
    public function provideTestFacadeDocBodyData(): iterable
275
    {
276
        yield 'all nullable parameters' => [
277
            null,
278
            null,
279
            null,
280
            null,
281
            [
282
                RequestOptions::BODY => null,
283
                RequestOptions::HEADERS => [
284
                    'Content-Type' => 'application/json',
285
                    'Authorization' => 'Bearer ' . self::TOKEN,
286
                ],
287
                RequestOptions::HTTP_ERRORS => true,
288
                RequestOptions::QUERY => null,
289
            ],
290
        ];
291
292
        yield 'only limit' => [
293
            1000,
294
            null,
295
            null,
296
            null,
297
            [
298
                RequestOptions::BODY => null,
299
                RequestOptions::HEADERS => [
300
                    'Content-Type' => 'application/json',
301
                    'Authorization' => 'Bearer ' . self::TOKEN,
302
                ],
303
                RequestOptions::HTTP_ERRORS => true,
304
                RequestOptions::QUERY => [
305
                    'limit' => 1000,
306
                ],
307
            ],
308
        ];
309
310
        yield 'only order column option' => [
311
            null,
312
            'order-column',
313
            null,
314
            null,
315
            [
316
                RequestOptions::BODY => null,
317
                RequestOptions::HEADERS => [
318
                    'Content-Type' => 'application/json',
319
                    'Authorization' => 'Bearer ' . self::TOKEN,
320
                ],
321
                RequestOptions::HTTP_ERRORS => true,
322
                RequestOptions::QUERY => [
323
                    'orderColumn' => 'order-column',
324
                ],
325
            ],
326
        ];
327
328
        yield 'only ordered column value option' => [
329
            null,
330
            null,
331
            'ordered-column-value',
332
            null,
333
            [
334
                RequestOptions::BODY => null,
335
                RequestOptions::HEADERS => [
336
                    'Content-Type' => 'application/json',
337
                    'Authorization' => 'Bearer ' . self::TOKEN,
338
                ],
339
                RequestOptions::HTTP_ERRORS => true,
340
                RequestOptions::QUERY => [
341
                    'orderedColumnValue' => 'ordered-column-value',
342
                ],
343
            ],
344
        ];
345
346
        yield 'only page dir option' => [
347
            null,
348
            null,
349
            null,
350
            'page-dir',
351
            [
352
                RequestOptions::BODY => null,
353
                RequestOptions::HEADERS => [
354
                    'Content-Type' => 'application/json',
355
                    'Authorization' => 'Bearer ' . self::TOKEN,
356
                ],
357
                RequestOptions::HTTP_ERRORS => true,
358
                RequestOptions::QUERY => [
359
                    'pageDir' => 'page-dir'
360
                ],
361
            ],
362
        ];
363
364
365
        yield 'all parameters' => [
366
            1000,
367
            'order-column',
368
            'ordered-column-value',
369
            'page-dir',
370
            [
371
                RequestOptions::BODY => null,
372
                RequestOptions::HEADERS => [
373
                    'Content-Type' => 'application/json',
374
                    'Authorization' => 'Bearer ' . self::TOKEN,
375
                ],
376
                RequestOptions::HTTP_ERRORS => true,
377
                RequestOptions::QUERY => [
378
                    'limit' => 1000,
379
                    'orderColumn' => 'order-column',
380
                    'orderedColumnValue' => 'ordered-column-value',
381
                    'pageDir' => 'page-dir',
382
                ],
383
            ],
384
        ];
385
    }
386
387
    public function testFacadeCisList(): void
388
    {
389
        $request = new FacadeCisListRequest(self::IDENTITY);
390
        $expectedResult = new FacadeCisListResponse();
391
        $requestBody = '{"cises": [' . self::IDENTITY . ']}';
392
393
        $this->serializer
394
            ->method('serialize')
395
            ->with($request)
396
            ->willReturn($requestBody);
397
398
        $this->serializer
399
            ->method('deserialize')
400
            ->with(
401
                get_class($expectedResult),
402
                self::API_RESPONSE
403
            )
404
            ->willReturn($expectedResult);
405
406
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
407
            ->method('request')
408
            ->with(
409
                'POST',
410
                'api/v4/facade/cis/cis_list',
411
                [
412
                    RequestOptions::BODY => $requestBody,
413
                    RequestOptions::HEADERS => [
414
                        'Content-Type' => 'application/json',
415
                        'Authorization' => 'Bearer ' . self::TOKEN,
416
                    ],
417
                    RequestOptions::HTTP_ERRORS => true,
418
                    RequestOptions::QUERY => null,
419
                ]
420
            )
421
            ->willReturn(
422
                (new Response())
423
                    ->withBody(stream_for(self::API_RESPONSE))
424
            );
425
426
        $result = $this->api->facadeCisList(self::TOKEN, $request);
427
428
        $this->assertEquals($expectedResult, $result);
429
    }
430
431
    public function testLkDocumentsCreate(): void
432
    {
433
        $request = new DocumentCreateRequest(
434
            'document',
435
            'MANUAL',
436
            'signature',
437
            ProductGroup::SHOES,
438
            DocumentLkType::LP_INTRODUCE_GOODS
439
        );
440
441
        $this->serializer
442
            ->method('serialize')
443
            ->with($request)
444
            ->willReturn(self::SERIALIZED_VALUE);
445
446
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
447
            ->method('request')
448
            ->with(
449
                'POST',
450
                'api/v3/lk/documents/create',
451
                [
452
                    RequestOptions::BODY => self::SERIALIZED_VALUE,
453
                    RequestOptions::HEADERS => [
454
                        'Content-Type' => 'application/json',
455
                        'Authorization' => 'Bearer ' . self::TOKEN,
456
                    ],
457
                    RequestOptions::HTTP_ERRORS => true,
458
                    RequestOptions::QUERY => ['pg' => ProductGroup::SHOES],
459
                ]
460
            )
461
            ->willReturn(
462
                (new Response())
463
                    ->withBody(stream_for(self::API_RESPONSE))
464
            );
465
466
        $result = $this->api->lkDocumentsCreate(self::TOKEN, $request);
467
468
        $this->assertEquals(self::API_RESPONSE, $result);
469
    }
470
471
    public function testProductInfo(): void
472
    {
473
        $request = ['aaa', 'bbb'];
474
        $expectedResult = new ProductInfoResponse([], 0);
475
476
        $this->serializer
477
            ->method('deserialize')
478
            ->with(
479
                get_class($expectedResult),
480
                self::API_RESPONSE
481
            )
482
            ->willReturn($expectedResult);
483
484
        $this->client->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects does only exist in PHPUnit\Framework\MockObject\MockObject, but not in GuzzleHttp\ClientInterface.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
485
            ->method('request')
486
            ->with(
487
                'GET',
488
                'api/v3/product/info',
489
                [
490
                    RequestOptions::BODY => null,
491
                    RequestOptions::HEADERS => [
492
                        'Content-Type' => 'application/json',
493
                        'Authorization' => 'Bearer ' . self::TOKEN,
494
                    ],
495
                    RequestOptions::HTTP_ERRORS => true,
496
                    RequestOptions::QUERY => [
497
                        'gtins' => implode(',', $request),
498
                    ],
499
                ]
500
            )
501
            ->willReturn(
502
                (new Response())
503
                    ->withBody(stream_for(self::API_RESPONSE))
504
            );
505
506
        $result = $this->api->productInfo(self::TOKEN, $request);
507
508
        $this->assertEquals($expectedResult, $result);
509
    }
510
}
511