diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ff40e8a..dfb6b9b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,27 @@ - - + - ./tests/*/Tests + ./tests/AtolOnlineClient + + + src + + diff --git a/tests/AtolOnlineClient/AtolOnlineApiTest.php b/tests/AtolOnlineClient/AtolOnlineApiTest.php new file mode 100644 index 0000000..6bcf6f4 --- /dev/null +++ b/tests/AtolOnlineClient/AtolOnlineApiTest.php @@ -0,0 +1,420 @@ +assertInstanceOf(AtolOnlineApi::class, $api); + + $this->assertSame(AtolOnlineApi::API_VERSION_V3, $api->getVersion()); + + $api->setVersion(AtolOnlineApi::API_VERSION_V4); + $this->assertSame(AtolOnlineApi::API_VERSION_V4, $api->getVersion()); + + $api->setLogger(new NullLogger()); + $this->assertInstanceOf(NullLogger::class, $this->getProperty($api, 'logger')); + + $api->setCache(new ArrayCache()); + $this->assertInstanceOf(ArrayCache::class, $this->getProperty($api, 'cache')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::sell + */ + public function testSell(): void + { + $responses = [ + new Response(200, [], $this->getTokenSuccessResponseV4()), + new Response(200, [], $this->getReportSuccessReportV4()), + ]; + + $request = (new AtolOnline())->serializeOperationRequest($this->getPaymentRecepientRequest()); + + $api = $this->getApi($responses); + $api->setCache(new ArrayCache()); + + $response = $api->sell($request); + + $this->assertSame('2ea26f17–0884–4f08–b120–306fc096a58f', json_decode($response, true)['uuid']); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::sellRefund + */ + public function testSellRefund(): void + { + $responses = [ + new Response(200, [], $this->getTokenSuccessResponseV4()), + new Response(200, [], $this->getReportSuccessReportV4()), + ]; + + $request = (new AtolOnline())->serializeOperationRequest($this->getPaymentRecepientRequest()); + + $api = $this->getApi($responses); + $api->setCache(new ArrayCache()); + + $response = $api->sellRefund($request); + + $this->assertSame('2ea26f17–0884–4f08–b120–306fc096a58f', json_decode($response, true)['uuid']); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::checkStatus + */ + public function testCheckStatusSuccessResponse(): void + { + $responses = [ + new Response(200, [], $this->getTokenSuccessResponseV4()), + new Response(200, [], $this->getReportSuccessReportV4()), + ]; + + $api = $this->getApi($responses); + $api->setCache(new ArrayCache()); + + $response = $this->callMethod($api, 'checkStatus', [ + 'uuid' => '2ea26f17–0884–4f08–b120–306fc096a58f', + ]); + + $this->assertSame('2ea26f17–0884–4f08–b120–306fc096a58f', json_decode($response, true)['uuid']); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getToken + */ + public function testGetTokenSuccessResponse(): void + { + $api = $this->getApi([new Response(200, [], $this->getTokenSuccessResponseV4())]); + $api->setCache(new ArrayCache()); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getToken + */ + public function testGetTokenErrorResponseWithLogger(): void + { + $logger = new TestLogger(); + + $api = $this->getApi([new Response(200, [], $this->getErrorResponseV4())]); + $api->setLogger($logger); + $api->setCache(new ArrayCache()); + + $this->assertFalse($this->callMethod($api, 'getToken')); + $this->assertTrue($logger->hasError('12 Неверный логин или пароль')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getToken + */ + public function testGetTokenSuccessResponseWithCache(): void + { + $cache = new ArrayCache(); + + $api = $this->getApi([new Response(200, [], $this->getTokenSuccessResponseV4())]); + $api->setCache($cache); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + $this->assertTrue($cache->contains($this->callMethod($api, 'getTokenCacheKey'))); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getToken + */ + public function testGetTokenSuccessResponseV3(): void + { + $api = $this->getApi([new Response(200, [], $this->getTokenSuccessResponseV3())]); + $api->setVersion(AtolOnlineApi::API_VERSION_V3); + $api->setCache(new ArrayCache()); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getToken + */ + public function testGetTokenSuccessResponseV3WithCache(): void + { + $cache = new ArrayCache(); + + $api = $this->getApi([new Response(200, [], $this->getTokenSuccessResponseV3())]); + $api->setCache($cache); + $api->setVersion(AtolOnlineApi::API_VERSION_V3); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + $this->assertTrue($cache->contains($this->callMethod($api, 'getTokenCacheKey'))); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', $this->callMethod($api, 'getToken')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::buildUrl + */ + public function testBuildUrlWithoutToken(): void + { + $args = ['operation' => 'test']; + + $this->assertSame('https://online.atol.ru/possystem/v4/group/test', $this->callMethod($this->getApi(), 'buildUrl', $args)); + + $api = $this->getApi(); + $api->setVersion(AtolOnlineApi::API_VERSION_V3); + $this->assertSame('https://online.atol.ru/possystem/v3/group/test', $this->callMethod($api, 'buildUrl', $args)); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::buildUrl + */ + public function testBuildUrlWithToken(): void + { + $args = ['operation' => 'test', 'token' => 'test']; + + $this->assertSame('https://online.atol.ru/possystem/v4/group/test?token=test', $this->callMethod($this->getApi(), 'buildUrl', $args)); + + $api = $this->getApi(); + $api->setVersion(AtolOnlineApi::API_VERSION_V3); + $this->assertSame('https://online.atol.ru/possystem/v3/group/test?tokenid=test', $this->callMethod($api, 'buildUrl', $args)); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::sendOperationRequest + */ + public function testSendOperationRequestSuccessResponse(): void + { + $responses = [ + new Response(200, [], $this->getTokenSuccessResponseV4()), + new Response(200, [], $this->getTokenSuccessResponseV4()) + ]; + + $request = (new AtolOnline())->serializeOperationRequest($this->getPaymentRecepientRequest()); + + $api = $this->getApi($responses); + $api->setCache(new ArrayCache()); + + $response = $this->callMethod($api, 'sendOperationRequest', [ + 'operation' => 'sell', + 'data' => $request, + ]); + + $this->assertSame('fj45u923j59ju42395iu9423i59243u0', json_decode($response->getBody(), true)['token']); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::logDebug + */ + public function testLogDebug(): void + { + $logger = new TestLogger(); + + $api = $this->getApi(); + $api->setLogger($logger); + + $this->callMethod($api, 'logDebug', [ + 'url' => '/test', + 'data' => 'test', + 'response' => new Response(200, ['X-Foo' => 'Bar', 'X-Foo2' => 'Bar2'], 'test'), + ]); + + $this->assertTrue($logger->hasDebug("* URL: /test\n * POSTFIELDS: test\n * RESPONSE HEADERS: HTTP/1.1 200 OK\r\nX-Foo: Bar\r\nX-Foo2: Bar2\r\n\r\n\n * RESPONSE BODY: test\n * ATTEMPTS: 0")); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::getTokenCacheKey + */ + public function testGetTokenCacheKey(): void + { + $this->assertSame('crm_fiscal_atol_online_token_68526766e6751745b52ae70b7bd3c6fe_v4', $this->callMethod($this->getApi(), 'getTokenCacheKey')); + + + $api = $this->getApi(); + $api->setVersion(AtolOnlineApi::API_VERSION_V3); + + $this->assertSame('crm_fiscal_atol_online_token_68526766e6751745b52ae70b7bd3c6fe_v3', $this->callMethod($api, 'getTokenCacheKey')); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnlineApi::isTokenExpired + */ + public function testIsTokenExpired(): void + { + $body = new \stdClass(); + $body->error = new \stdClass(); + $body->error->code = 4; + + $this->assertTrue($this->callMethod($this->getApi(), 'isTokenExpired', ['body' => $body])); + + $body = new \stdClass(); + $this->assertFalse($this->callMethod($this->getApi(), 'isTokenExpired', ['body' => $body])); + } + + /** + * @param array $responses + * @param bool $debug + * @param bool $test + * @return AtolOnlineApi + */ + private function getApi(array $responses = [], bool $debug = true, bool $test = false): AtolOnlineApi + { + $connection = new Connection(); + $connection->login = 'login'; + $connection->pass = 'pass'; + $connection->group = 'group'; + $connection->sno = Connection::SNO_GENERAL; + $connection->version = AtolOnlineApi::API_VERSION_V4; + $connection->setDebug($debug); + $connection->setTestMode($test); + + $plugin = new MockPlugin(); + + foreach ($responses as $response) { + $plugin->addResponse($response); + } + + $client = new Client(); + $client->addSubscriber($plugin); + + return new AtolOnlineApi($client, $connection); + } + + /** + * @param mixed $object + * @param string $name + * @param array $args + * @return mixed + */ + private function callMethod($object, string $name, array $args = []) + { + $reflection = new \ReflectionClass($object); + $method = $reflection->getMethod($name); + $method->setAccessible(true); + + return $method->invokeArgs($object, $args); + } + + /** + * @param mixed $object + * @param string $name + * @return mixed + */ + private function getProperty($object, string $name) + { + $reflection = new \ReflectionClass($object); + $property = $reflection->getProperty($name); + $property->setAccessible(true); + + return $property->getValue($object); + } + + /** + * @return false|string + */ + private function getTokenSuccessResponseV3() + { + return json_encode([ + 'token' => 'fj45u923j59ju42395iu9423i59243u0', + 'code' => 1, + ]); + } + + /** + * @return false|string + */ + private function getTokenSuccessResponseV4() + { + return json_encode([ + 'error' => null, + 'token' => 'fj45u923j59ju42395iu9423i59243u0', + 'timestamp' => '30.11.2017 17:58:53', + ]); + } + + /** + * @return false|string + */ + private function getErrorResponseV4() + { + return json_encode([ + 'error' => [ + 'error_id' => '4475d6d8d-844d-4d05-aa8b-e3dbdf3defd5', + 'code' => 12, + 'text' => 'Неверный логин или пароль', + 'type' => 'system', + ], + 'timestamp' => '30.11.2017 17:58:53', + ]); + } + + /** + * @return string + */ + private function getReportSuccessReportV4(): string + { + return file_get_contents(__DIR__.'/../fixtures/success_response_v4_3.json'); + } + + /** + * @return PaymentReceiptRequest + */ + private function getPaymentRecepientRequest(): PaymentReceiptRequest + { + $service = new ServiceRequest(); + $service->setCallbackUrl('test.local'); + + $receipt = new ReceiptRequest(); + $receipt->setTotal('100'); + + /** @var PaymentReceiptRequest $request */ + $request = new PaymentReceiptRequest(); + $request->setExternalId('test'); + $request->setService($service); + $request->setReceipt($receipt); + + return $request; + } +} diff --git a/tests/AtolOnlineClient/AtolOnlineTest.php b/tests/AtolOnlineClient/AtolOnlineTest.php new file mode 100644 index 0000000..95cf87f --- /dev/null +++ b/tests/AtolOnlineClient/AtolOnlineTest.php @@ -0,0 +1,244 @@ +atol = new AtolOnline(); + } + + /** + * @return void + * @covers \AtolOnlineClient\AtolOnline::__construct + */ + public function testConstructor(): void + { + $reflection = new \ReflectionClass(get_class($this->atol)); + + $property = $reflection->getProperty('serializer'); + $property->setAccessible(true); + + $this->assertInstanceOf(SerializerInterface::class, $property->getValue($this->atol)); + } + + /** + * @covers \AtolOnlineClient\AtolOnline::createConfiguration + * @return void + */ + public function testCreateConfiguration(): void + { + $this->assertInstanceOf(ConfigurationInterface::class, $this->atol->createConfiguration()); + } + + /** + * @param string $file + * @covers \AtolOnlineClient\AtolOnline::deserializeOperationResponse + * @dataProvider dataSuccessResponse + */ + public function testSuccessDeserializeOperationResponse(string $file): void + { + $response = file_get_contents(__DIR__.'/../fixtures/'. $file); + + $operationResponse = $this->atol->deserializeOperationResponse($response); + + $this->assertEquals('12.04.2017 06:15:06', $operationResponse->getTimestamp()); + } + + /** + * @param string $file + * @covers \AtolOnlineClient\AtolOnline::deserializeOperationResponse + * @dataProvider dataErrorResponse + */ + public function testErrorDeserializeOperationResponse(string $file): void + { + $response = file_get_contents(__DIR__.'/../fixtures/'. $file); + + $operationResponse = $this->atol->deserializeOperationResponse($response); + + $this->assertEquals('12.04.2017 06:15:06', $operationResponse->getTimestamp()); + $this->assertEquals('fail', $operationResponse->getStatus()); + $this->assertEquals(30, $operationResponse->getError()->getCode()); + $this->assertEquals('system', $operationResponse->getError()->getType()); + + $this->assertEquals( + ' Передан некорректный UUID : "{0}". Необходимо повторить запрос с корректными данными ', + $operationResponse->getError()->getText() + ); + } + + /** + * @covers \AtolOnlineClient\AtolOnline::deserializeOperationResponse + */ + public function testFailDeserializeOperationResponse(): void + { + $this->expectException(RuntimeException::class); + + $this->atol->deserializeOperationResponse(''); + } + + /** + * @param string $file + * @covers \AtolOnlineClient\AtolOnline::deserializeCheckStatusResponse + * @dataProvider dataSuccessResponse + */ + public function testSuccessDeserializeCheckStatusResponse(string $file): void + { + $response = file_get_contents(__DIR__.'/../fixtures/'. $file); + + $operationResponse = $this->atol->deserializeCheckStatusResponse($response); + + $this->assertEquals('12.04.2017 06:15:06', $operationResponse->getTimestamp()); + } + + /** + * @covers \AtolOnlineClient\AtolOnline::deserializeCheckStatusResponse + */ + public function testFailDeserializeCheckStatusResponse(): void + { + $this->expectException(RuntimeException::class); + + $this->atol->deserializeCheckStatusResponse(''); + } + + /** + * @covers \AtolOnlineClient\AtolOnline::serializeOperationRequest + */ + public function testSerializeOperationRequest(): void + { + $service = new ServiceRequest(); + $service->setCallbackUrl('test.local'); + + $receipt = new ReceiptRequest(); + $receipt->setTotal('100'); + + /** @var PaymentReceiptRequest $paymentReceipt */ + $paymentReceipt = new PaymentReceiptRequest(); + + $reflection = new \ReflectionClass($paymentReceipt); + $property = $reflection->getProperty('timestamp'); + $property->setAccessible(true); + $property->setValue($paymentReceipt, 1); + + $paymentReceipt->setExternalId('test'); + $paymentReceipt->setService($service); + $paymentReceipt->setReceipt($receipt); + + $request = $this->atol->serializeOperationRequest($paymentReceipt); + + $this->assertEquals('{"external_id":"test","receipt":{"total":100},"timestamp":"1","service":{"callback_url":"test.local"}}', $request); + } + + /** + * @return void + * + * @covers \AtolOnlineClient\AtolOnline::createApi + */ + public function testCreateApi(): void + { + $api1 = $this->atol->createApi(new Client(), new Connection()); + $api2 = $this->atol->createApi(new Client(), new Connection()); + + $this->assertSame($api1, $api2); + } + + /** + * @return void + * + * @covers \AtolOnlineClient\AtolOnline::getApi + */ + public function testGetApi(): void + { + $api1 = $this->atol->createApi(new Client(), new Connection()); + $api2 = $this->atol->getApi(); + + $this->assertSame($api1, $api2); + } + + /** + * @return array + */ + public function dataSuccessResponse(): array + { + return [ + ['success_response_v4_1.json'], + ['success_response_v4_2.json'], + ['success_response_v4_3.json'], + ]; + } + + /** + * @return array + */ + public function dataErrorResponse(): array + { + return [ + ['error_response_v3.json'], + ['error_response_v4.json'] + ]; + } + + /** + * @return array + */ + public function dataInvalidResponse(): array + { + return [ + [ + 'code' => 404, + 'message' => 'Not Found', + 'html' => '404 Not Found

404 Not Found


openresty/1.15.8.1rc1
', + ], + [ + 'code' => 502, + 'message' => 'Bad Gateway', + 'html' => '502 Bad Gateway

502 Bad Gateway


nginx/1.15.8
', + ], + [ + 'code' => null, + 'message' => null, + 'html' => '', + ], + [ + 'code' => null, + 'message' => null, + 'html' => '', + ], + ]; + } + + /** + * @param mixed $object + * @param string $name + * @param array $args + * @return mixed + */ + private function callMethod($object, string $name, array $args = []) + { + $reflection = new \ReflectionClass($object); + $method = $reflection->getMethod($name); + $method->setAccessible(true); + + return $method->invokeArgs($object, $args); + } +} diff --git a/tests/AtolOnlineClient/Configuration/ConnectionTest.php b/tests/AtolOnlineClient/Configuration/ConnectionTest.php new file mode 100644 index 0000000..37a9ff2 --- /dev/null +++ b/tests/AtolOnlineClient/Configuration/ConnectionTest.php @@ -0,0 +1,90 @@ +connection = new Connection(); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration\Connection::setDebug + * @covers \AtolOnlineClient\Configuration\Connection::isDebug + */ + public function testDebug(): void + { + $this->assertFalse($this->connection->isDebug()); + + $this->connection->setDebug(true); + $this->assertTrue($this->connection->isDebug()); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration\Connection::isTestMode + * @covers \AtolOnlineClient\Configuration\Connection::setTestMode + */ + public function testTestMode(): void + { + $this->assertFalse($this->connection->isTestMode()); + + $this->connection->setTestMode(true); + $this->assertTrue($this->connection->isTestMode()); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration\Connection::getVersion + * @covers \AtolOnlineClient\Configuration\Connection::isVersion4 + * @covers \AtolOnlineClient\Configuration\Connection::isVersion3 + */ + public function testVersion(): void + { + $this->connection->version = AtolOnlineApi::API_VERSION_V3; + $this->assertEquals(AtolOnlineApi::API_VERSION_V3, $this->connection->getVersion()); + $this->assertTrue($this->connection->isVersion3()); + + $this->connection->version = AtolOnlineApi::API_VERSION_V4; + $this->assertTrue($this->connection->isVersion4()); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration\Connection::loadValidatorMetadata + */ + public function testValidator(): void + { + + $validator = Validation::createValidatorBuilder() + ->addMethodMapping('loadValidatorMetadata') + ->getValidator(); + + $list = $validator->validate($this->connection); + + $this->assertEquals(3, $list->count()); + + $this->connection->login = 'login'; + $this->connection->pass = 'login'; + $this->connection->group = 'group'; + + $list = $validator->validate($this->connection); + + $this->assertEquals(0, $list->count()); + } +} diff --git a/tests/AtolOnlineClient/ConfigurationTest.php b/tests/AtolOnlineClient/ConfigurationTest.php new file mode 100644 index 0000000..5afc5d8 --- /dev/null +++ b/tests/AtolOnlineClient/ConfigurationTest.php @@ -0,0 +1,79 @@ +configuration = new Configuration(); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration::isDebug + * @covers \AtolOnlineClient\Configuration::setDebug + */ + public function testDebug(): void + { + $this->assertFalse((bool) $this->configuration->isDebug()); + + $this->configuration->setDebug(true); + $this->assertTrue($this->configuration->isDebug()); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration::isEnabled + * @covers \AtolOnlineClient\Configuration::setEnabled + */ + public function testEnabled(): void + { + $this->configuration->setEnabled(true); + $this->assertTrue($this->configuration->isEnabled()); + + $this->configuration->setEnabled(false); + $this->assertFalse($this->configuration->isEnabled()); + } + + /** + * @return void + * @covers \AtolOnlineClient\Configuration::loadValidatorMetadata + */ + public function testValidator(): void + { + + $validator = Validation::createValidatorBuilder() + ->addMethodMapping('loadValidatorMetadata') + ->getValidator(); + + $list = $validator->validate($this->configuration); + + $this->assertEquals(1, $list->count()); + + $connection = new Configuration\Connection(); + $connection->login = 'login'; + $connection->pass = 'login'; + $connection->group = 'group'; + + $this->configuration->connections[] = $connection; + + $list = $validator->validate($this->configuration); + + $this->assertEquals(0, $list->count()); + } +} diff --git a/tests/AtolOnlineClient/Response/ResponseTest.php b/tests/AtolOnlineClient/Response/ResponseTest.php new file mode 100644 index 0000000..6b71c30 --- /dev/null +++ b/tests/AtolOnlineClient/Response/ResponseTest.php @@ -0,0 +1,63 @@ +build(); + + $response = '{ + "uuid": "4355", + "timestamp": "12.04.2017 06:15:06", + "status": "fail", + "error": { + "error_id": "475d6d8d-844d-4d05-aa8b-e3dbdf4defd6", + "code": 30, + "text": " Передан некорректный UUID : \"{0}\". Необходимо повторить запрос с корректными данными ", + "type": "system" + }, + "payload": { + "total": 1598, + "fns_site": "www.nalog.ru", + "fn_number": "1110000100238211", + "shift_number": 23, + "receipt_datetime": "12.04.2017 20:16:00", + "fiscal_receipt_number": 6, + "fiscal_document_number": 133, + "ecr_registration_number": "0000111118041361", + "fiscal_document_attribute": 3449555941 + }, + "group_code": " MyCompany_MyShop", + "daemon_code": "prod–agent–1", + "device_code": "KSR13.00–1–11", + "external_id": "TRF10601_1", + "callback_url": "" +}'; + $response = $serializer->deserialize( + $response, + OperationResponse::class, + 'json' + ); + + $serializer->serialize( + $response, + 'json' + ); + + $this->assertTrue(true); + } +} diff --git a/tests/AtolOnlineClient/Tests/AtolOnlineTest.php b/tests/AtolOnlineClient/Tests/AtolOnlineTest.php deleted file mode 100644 index ad5249d..0000000 --- a/tests/AtolOnlineClient/Tests/AtolOnlineTest.php +++ /dev/null @@ -1,46 +0,0 @@ -assertInstanceOf(Configuration::class, $atol->createConfiguration()); - } - - - /** - * @dataProvider dataSellErrorResponse - */ - public function testDeserializeOperationResponse($file) - { - $response = file_get_contents(__DIR__ . '/data/'. $file); - $atol = new AtolOnline(); - $operationResponse = $atol->deserializeOperationResponse($response); - $this->assertInstanceOf(OperationResponse::class, $operationResponse); - $this->assertEquals('12.04.2017 06:15:06', $operationResponse->getTimestamp()); - $this->assertEquals('fail', $operationResponse->getStatus()); - $this->assertEquals(30, $operationResponse->getError()->getCode()); - $this->assertEquals('system', $operationResponse->getError()->getType()); - $this->assertEquals( - ' Передан некорректный UUID : "{0}". Необходимо повторить запрос с корректными данными ', - $operationResponse->getError()->getText() - ); - } - - public function dataSellErrorResponse() - { - return [ - ['sell_error_response_v3.json'], - ['sell_error_response_v3.json'] - ]; - } -} diff --git a/bootstrap.php b/tests/bootstrap.php similarity index 79% rename from bootstrap.php rename to tests/bootstrap.php index 8c24c52..6559848 100644 --- a/bootstrap.php +++ b/tests/bootstrap.php @@ -1,13 +1,13 @@