This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Lamoda\OmsClient\Tests\V2; |
||
| 6 | |||
| 7 | use GuzzleHttp\ClientInterface; |
||
| 8 | use GuzzleHttp\Exception\BadResponseException; |
||
| 9 | use GuzzleHttp\Psr7\Response; |
||
| 10 | use GuzzleHttp\RequestOptions; |
||
| 11 | use Lamoda\OmsClient\Exception\OmsGeneralErrorException; |
||
| 12 | use Lamoda\OmsClient\Exception\OmsRequestErrorException; |
||
| 13 | use Lamoda\OmsClient\Exception\OmsSignerErrorException; |
||
| 14 | use Lamoda\OmsClient\Serializer\SerializerInterface; |
||
| 15 | use Lamoda\OmsClient\V2\Dto\CloseICArrayResponse; |
||
| 16 | use Lamoda\OmsClient\V2\Dto\CreateOrderForEmissionICRequestLight; |
||
| 17 | use Lamoda\OmsClient\V2\Dto\CreateOrderForEmissionICRequestLp; |
||
| 18 | use Lamoda\OmsClient\V2\Dto\CreateOrderForEmissionICResponse; |
||
| 19 | use Lamoda\OmsClient\V2\Dto\GetICBufferStatusResponse; |
||
| 20 | use Lamoda\OmsClient\V2\Dto\GetICsFromOrderResponse; |
||
| 21 | use Lamoda\OmsClient\V2\Extension; |
||
| 22 | use Lamoda\OmsClient\V2\OmsApi; |
||
| 23 | use Lamoda\OmsClient\V2\Signer\SignerInterface; |
||
| 24 | use PHPUnit\Framework\Assert; |
||
| 25 | use PHPUnit\Framework\MockObject\MockObject; |
||
| 26 | use PHPUnit\Framework\TestCase; |
||
| 27 | use Psr\Http\Message\RequestInterface; |
||
| 28 | use function GuzzleHttp\Psr7\stream_for; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @covers \Lamoda\OmsClient\V2\OmsApi |
||
| 32 | */ |
||
| 33 | final class OmsApiTest extends TestCase |
||
| 34 | { |
||
| 35 | private const TOKEN = 'abcdefg12345678'; |
||
| 36 | private const API_RESPONSE = '{stub_result}'; |
||
| 37 | private const OMS_ID = '123456'; |
||
| 38 | private const ORDER_ID = 'af7a55ae-83de-470b-a1bd-6bbf657106ef'; |
||
| 39 | private const GTIN = '046000012345'; |
||
| 40 | private const MARKING_CODE = "010467003301005321gJk6o54AQBJfX\u{001d}91ffd0\u{001d}92LGYcm3FRQrRdNOO+8t0pz78QTyxxBmYKhLXaAS03jKV7oy+DWGy1SeU+BZ8o7B8+hs9LvPdNA7B6NPGjrCm34A=="; |
||
| 41 | private const LAST_BLOCK_ID = '123456'; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var ClientInterface | MockObject |
||
| 45 | */ |
||
| 46 | private $client; |
||
| 47 | /** |
||
| 48 | * @var SerializerInterface | MockObject |
||
| 49 | */ |
||
| 50 | private $serializer; |
||
| 51 | /** |
||
| 52 | * @var OmsApi |
||
| 53 | */ |
||
| 54 | private $api; |
||
| 55 | |||
| 56 | protected function setUp(): void |
||
| 57 | { |
||
| 58 | parent::setUp(); |
||
| 59 | |||
| 60 | $this->client = $this->createMock(ClientInterface::class); |
||
|
0 ignored issues
–
show
|
|||
| 61 | $this->serializer = $this->createMock(SerializerInterface::class); |
||
|
0 ignored issues
–
show
It seems like
$this->createMock(\Lamod...alizerInterface::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Lamoda\OmsClient\...er\SerializerInterface> of property $serializer.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 62 | |||
| 63 | $this->api = new OmsApi( |
||
| 64 | $this->client, |
||
|
0 ignored issues
–
show
$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...
|
|||
| 65 | $this->serializer |
||
|
0 ignored issues
–
show
$this->serializer is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Lamoda\OmsClient\...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...
|
|||
| 66 | ); |
||
| 67 | } |
||
| 68 | |||
| 69 | public function testExceptionWithHttpCode(): void |
||
| 70 | { |
||
| 71 | $this->client |
||
|
0 ignored issues
–
show
The method
method() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 72 | ->method('request') |
||
| 73 | ->willThrowException(new BadResponseException('Bad response', $this->createMock(RequestInterface::class))); |
||
|
0 ignored issues
–
show
$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...
|
|||
| 74 | |||
| 75 | $this->expectException(OmsRequestErrorException::class); |
||
| 76 | $this->api->getICBufferStatus(Extension::light(), self::TOKEN, self::OMS_ID, self::ORDER_ID, self::GTIN); |
||
| 77 | } |
||
| 78 | |||
| 79 | public function testGeneralException(): void |
||
| 80 | { |
||
| 81 | $this->client |
||
|
0 ignored issues
–
show
The method
method() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 82 | ->method('request') |
||
| 83 | ->willThrowException(new \RuntimeException()); |
||
| 84 | |||
| 85 | $this->expectException(OmsGeneralErrorException::class); |
||
| 86 | $this->api->getICBufferStatus(Extension::light(), self::TOKEN, self::OMS_ID, self::ORDER_ID, self::GTIN); |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @dataProvider dataCorrectUsageOfExtensions |
||
| 91 | */ |
||
| 92 | public function testCorrectUsageOfExtensions(Extension $extension, string $extensionName): void |
||
| 93 | { |
||
| 94 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 95 | ->method('request') |
||
| 96 | ->with( |
||
| 97 | $this->anything(), |
||
| 98 | sprintf('api/v2/%s/buffer/status', $extensionName), |
||
| 99 | $this->anything() |
||
| 100 | ) |
||
| 101 | ->willReturn( |
||
| 102 | (new Response()) |
||
| 103 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 104 | ); |
||
| 105 | |||
| 106 | $expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, ''); |
||
| 107 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 108 | ->method('deserialize') |
||
| 109 | ->willReturn($expectedResult); |
||
| 110 | |||
| 111 | $this->api->getICBufferStatus($extension, self::TOKEN, self::OMS_ID, self::ORDER_ID, self::GTIN); |
||
| 112 | } |
||
| 113 | |||
| 114 | public function dataCorrectUsageOfExtensions(): array |
||
| 115 | { |
||
| 116 | return [ |
||
| 117 | [ |
||
| 118 | Extension::light(), |
||
| 119 | 'light', |
||
| 120 | ], |
||
| 121 | [ |
||
| 122 | Extension::pharma(), |
||
| 123 | 'pharma', |
||
| 124 | ], |
||
| 125 | ]; |
||
| 126 | } |
||
| 127 | |||
| 128 | public function testCreateOrderForEmissionIC(): void |
||
| 129 | { |
||
| 130 | $createOrderForEmissionICRequestLp = new CreateOrderForEmissionICRequestLp( |
||
| 131 | '', |
||
| 132 | '', |
||
| 133 | '', |
||
| 134 | '', |
||
| 135 | [] |
||
| 136 | ); |
||
| 137 | |||
| 138 | $serializedRequest = '{"test": "value"}'; |
||
| 139 | |||
| 140 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 141 | ->method('serialize') |
||
| 142 | ->with( |
||
| 143 | $createOrderForEmissionICRequestLp |
||
| 144 | ) |
||
| 145 | ->willReturn($serializedRequest); |
||
| 146 | |||
| 147 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 148 | ->method('request') |
||
| 149 | ->with( |
||
| 150 | 'POST', |
||
| 151 | 'api/v2/lp/orders', |
||
| 152 | [ |
||
| 153 | RequestOptions::BODY => $serializedRequest, |
||
| 154 | RequestOptions::HEADERS => [ |
||
| 155 | 'Content-Type' => 'application/json', |
||
| 156 | 'clientToken' => self::TOKEN, |
||
| 157 | ], |
||
| 158 | RequestOptions::QUERY => [ |
||
| 159 | 'omsId' => self::OMS_ID, |
||
| 160 | ], |
||
| 161 | RequestOptions::HTTP_ERRORS => true, |
||
| 162 | ] |
||
| 163 | ) |
||
| 164 | ->willReturn( |
||
| 165 | (new Response()) |
||
| 166 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 167 | ); |
||
| 168 | |||
| 169 | $expectedResult = new CreateOrderForEmissionICResponse(self::OMS_ID, self::ORDER_ID, 100); |
||
| 170 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 171 | ->method('deserialize') |
||
| 172 | ->with( |
||
| 173 | CreateOrderForEmissionICResponse::class, |
||
| 174 | self::API_RESPONSE |
||
| 175 | ) |
||
| 176 | ->willReturn($expectedResult); |
||
| 177 | |||
| 178 | |||
| 179 | $result = $this->api->createOrderForEmissionIC( |
||
| 180 | self::TOKEN, |
||
| 181 | self::OMS_ID, |
||
| 182 | $createOrderForEmissionICRequestLp |
||
| 183 | ); |
||
| 184 | |||
| 185 | $this->assertEquals($expectedResult, $result); |
||
| 186 | } |
||
| 187 | |||
| 188 | public function testCreateOrderForEmissionICWithSignature(): void |
||
| 189 | { |
||
| 190 | $createOrderForEmissionICRequestLp = new CreateOrderForEmissionICRequestLp( |
||
| 191 | '', |
||
| 192 | '', |
||
| 193 | '', |
||
| 194 | '', |
||
| 195 | [] |
||
| 196 | ); |
||
| 197 | |||
| 198 | $serializedRequest = '{"test": "value"}'; |
||
| 199 | $signature = 'signature'; |
||
| 200 | |||
| 201 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 202 | ->method('serialize') |
||
| 203 | ->with( |
||
| 204 | $createOrderForEmissionICRequestLp |
||
| 205 | ) |
||
| 206 | ->willReturn($serializedRequest); |
||
| 207 | |||
| 208 | |||
| 209 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 210 | ->method('request') |
||
| 211 | ->with( |
||
| 212 | 'POST', |
||
| 213 | 'api/v2/lp/orders', |
||
| 214 | [ |
||
| 215 | RequestOptions::BODY => $serializedRequest, |
||
| 216 | RequestOptions::HEADERS => [ |
||
| 217 | 'Content-Type' => 'application/json', |
||
| 218 | 'clientToken' => self::TOKEN, |
||
| 219 | 'X-Signature' => $signature |
||
| 220 | ], |
||
| 221 | RequestOptions::QUERY => [ |
||
| 222 | 'omsId' => self::OMS_ID, |
||
| 223 | ], |
||
| 224 | RequestOptions::HTTP_ERRORS => true, |
||
| 225 | ] |
||
| 226 | ) |
||
| 227 | ->willReturn( |
||
| 228 | (new Response()) |
||
| 229 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 230 | ); |
||
| 231 | |||
| 232 | $expectedResult = new CreateOrderForEmissionICResponse(self::OMS_ID, self::ORDER_ID, 100); |
||
| 233 | $this->serializer |
||
|
0 ignored issues
–
show
The method
method() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 234 | ->method('deserialize') |
||
| 235 | ->willReturn($expectedResult); |
||
| 236 | |||
| 237 | $signer = $this->createMock(SignerInterface::class); |
||
| 238 | $signer->method('sign') |
||
|
0 ignored issues
–
show
The method
method() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 239 | ->with($serializedRequest) |
||
| 240 | ->willReturn($signature); |
||
| 241 | |||
| 242 | $result = $this->api->createOrderForEmissionIC( |
||
| 243 | self::TOKEN, |
||
| 244 | self::OMS_ID, |
||
| 245 | $createOrderForEmissionICRequestLp, |
||
| 246 | $signer |
||
|
0 ignored issues
–
show
$signer is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<Lamoda\OmsCl...Signer\SignerInterface>.
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...
|
|||
| 247 | ); |
||
| 248 | |||
| 249 | $this->assertEquals($expectedResult, $result); |
||
| 250 | } |
||
| 251 | |||
| 252 | public function testCreateOrderForEmissionFinishedWithSignerException(): void |
||
| 253 | { |
||
| 254 | $createOrderForEmissionICRequestLp = new CreateOrderForEmissionICRequestLp( |
||
| 255 | '', |
||
| 256 | '', |
||
| 257 | '', |
||
| 258 | '', |
||
| 259 | [] |
||
| 260 | ); |
||
| 261 | |||
| 262 | $serializedRequest = '{"test": "value"}'; |
||
| 263 | |||
| 264 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 265 | ->method('serialize') |
||
| 266 | ->with( |
||
| 267 | $createOrderForEmissionICRequestLp |
||
| 268 | ) |
||
| 269 | ->willReturn($serializedRequest); |
||
| 270 | |||
| 271 | |||
| 272 | $this->client->expects($this->never()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 273 | ->method('request'); |
||
| 274 | |||
| 275 | $signer = $this->createMock(SignerInterface::class); |
||
| 276 | $signer->method('sign') |
||
|
0 ignored issues
–
show
The method
method() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 277 | ->willThrowException(new \Exception('Something happened in signer')); |
||
| 278 | |||
| 279 | $this->expectException(OmsSignerErrorException::class); |
||
| 280 | $this->api->createOrderForEmissionIC( |
||
| 281 | self::TOKEN, |
||
| 282 | self::OMS_ID, |
||
| 283 | $createOrderForEmissionICRequestLp, |
||
| 284 | $signer |
||
|
0 ignored issues
–
show
$signer is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<Lamoda\OmsCl...Signer\SignerInterface>.
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...
|
|||
| 285 | ); |
||
| 286 | } |
||
| 287 | |||
| 288 | public function testGetICBufferStatus(): void |
||
| 289 | { |
||
| 290 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 291 | ->method('request') |
||
| 292 | ->with( |
||
| 293 | 'GET', |
||
| 294 | 'api/v2/light/buffer/status', |
||
| 295 | [ |
||
| 296 | RequestOptions::BODY => null, |
||
| 297 | RequestOptions::HEADERS => [ |
||
| 298 | 'Content-Type' => 'application/json', |
||
| 299 | 'clientToken' => self::TOKEN, |
||
| 300 | ], |
||
| 301 | RequestOptions::QUERY => [ |
||
| 302 | 'omsId' => self::OMS_ID, |
||
| 303 | 'orderId' => self::ORDER_ID, |
||
| 304 | 'gtin' => self::GTIN, |
||
| 305 | ], |
||
| 306 | RequestOptions::HTTP_ERRORS => true, |
||
| 307 | ] |
||
| 308 | ) |
||
| 309 | ->willReturn( |
||
| 310 | (new Response()) |
||
| 311 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 312 | ); |
||
| 313 | |||
| 314 | $expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, ''); |
||
| 315 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 316 | ->method('deserialize') |
||
| 317 | ->with( |
||
| 318 | GetICBufferStatusResponse::class, |
||
| 319 | self::API_RESPONSE |
||
| 320 | ) |
||
| 321 | ->willReturn($expectedResult); |
||
| 322 | |||
| 323 | $result = $this->api->getICBufferStatus(Extension::light(), self::TOKEN, self::OMS_ID, self::ORDER_ID, |
||
| 324 | self::GTIN); |
||
| 325 | |||
| 326 | $this->assertEquals($expectedResult, $result); |
||
| 327 | } |
||
| 328 | |||
| 329 | public function testGetICsFromOrder(): void |
||
| 330 | { |
||
| 331 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 332 | ->method('request') |
||
| 333 | ->with( |
||
| 334 | 'GET', |
||
| 335 | 'api/v2/light/codes', |
||
| 336 | [ |
||
| 337 | RequestOptions::BODY => null, |
||
| 338 | RequestOptions::HEADERS => [ |
||
| 339 | 'Content-Type' => 'application/json', |
||
| 340 | 'clientToken' => self::TOKEN, |
||
| 341 | ], |
||
| 342 | RequestOptions::QUERY => [ |
||
| 343 | 'omsId' => self::OMS_ID, |
||
| 344 | 'orderId' => self::ORDER_ID, |
||
| 345 | 'gtin' => self::GTIN, |
||
| 346 | 'quantity' => 2, |
||
| 347 | 'lastBlockId' => '1', |
||
| 348 | ], |
||
| 349 | RequestOptions::HTTP_ERRORS => true, |
||
| 350 | ] |
||
| 351 | ) |
||
| 352 | ->willReturn( |
||
| 353 | (new Response()) |
||
| 354 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 355 | ); |
||
| 356 | |||
| 357 | $expectedResult = new GetICsFromOrderResponse(self::OMS_ID, [self::MARKING_CODE], '2'); |
||
| 358 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 359 | ->method('deserialize') |
||
| 360 | ->with( |
||
| 361 | GetICsFromOrderResponse::class, |
||
| 362 | self::API_RESPONSE |
||
| 363 | ) |
||
| 364 | ->willReturn($expectedResult); |
||
| 365 | |||
| 366 | $result = $this->api->getICsFromOrder(Extension::light(), self::TOKEN, self::OMS_ID, self::ORDER_ID, self::GTIN, |
||
| 367 | 2, '1'); |
||
| 368 | |||
| 369 | $this->assertEquals($expectedResult, $result); |
||
| 370 | } |
||
| 371 | |||
| 372 | public function testCloseICArray(): void |
||
| 373 | { |
||
| 374 | $this->client->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<GuzzleHttp\ClientInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 375 | ->method('request') |
||
| 376 | ->with( |
||
| 377 | 'POST', |
||
| 378 | 'api/v2/light/buffer/close', |
||
| 379 | [ |
||
| 380 | RequestOptions::BODY => null, |
||
| 381 | RequestOptions::HEADERS => [ |
||
| 382 | 'Content-Type' => 'application/json', |
||
| 383 | 'clientToken' => self::TOKEN, |
||
| 384 | ], |
||
| 385 | RequestOptions::QUERY => [ |
||
| 386 | 'omsId' => self::OMS_ID, |
||
| 387 | 'orderId' => self::ORDER_ID, |
||
| 388 | 'gtin' => self::GTIN, |
||
| 389 | 'lastBlockId' => self::LAST_BLOCK_ID, |
||
| 390 | ], |
||
| 391 | RequestOptions::HTTP_ERRORS => true, |
||
| 392 | ] |
||
| 393 | ) |
||
| 394 | ->willReturn( |
||
| 395 | (new Response()) |
||
| 396 | ->withBody(stream_for(self::API_RESPONSE)) |
||
| 397 | ); |
||
| 398 | |||
| 399 | $expectedResult = new CloseICArrayResponse(self::OMS_ID); |
||
| 400 | $this->serializer->expects($this->once()) |
||
|
0 ignored issues
–
show
The method
expects() does not seem to exist on object<Lamoda\OmsClient\...er\SerializerInterface>.
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||
| 401 | ->method('deserialize') |
||
| 402 | ->with( |
||
| 403 | CloseICArrayResponse::class, |
||
| 404 | self::API_RESPONSE |
||
| 405 | ) |
||
| 406 | ->willReturn($expectedResult); |
||
| 407 | |||
| 408 | $result = $this->api->closeICArray( |
||
| 409 | Extension::light(), |
||
| 410 | self::TOKEN, |
||
| 411 | self::OMS_ID, |
||
| 412 | self::ORDER_ID, |
||
| 413 | self::GTIN, |
||
| 414 | self::LAST_BLOCK_ID |
||
| 415 | ); |
||
| 416 | |||
| 417 | $this->assertEquals($expectedResult, $result); |
||
| 418 | } |
||
| 419 | |||
| 420 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..