diff --git a/composer.json b/composer.json
index cc0c954..28b4669 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,8 @@
"php-http/httplug": "^2.2",
"php-http/message-factory": "^1.0",
"php-http/discovery": "^1.12",
- "php-http/multipart-stream-builder": "^1.1"
+ "php-http/multipart-stream-builder": "^1.1",
+ "symfony/expression-language": "^5.1"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
diff --git a/phpmd.xml b/phpmd.xml
index 7795826..71a42db 100644
--- a/phpmd.xml
+++ b/phpmd.xml
@@ -8,6 +8,7 @@
+
@@ -42,6 +43,11 @@
+
+
+
+
+
tests/*
diff --git a/src/Component/Exception/TopApiException.php b/src/Component/Exception/TopApiException.php
index 4edf4d8..63a2d9b 100644
--- a/src/Component/Exception/TopApiException.php
+++ b/src/Component/Exception/TopApiException.php
@@ -13,7 +13,7 @@
namespace RetailCrm\Component\Exception;
use Exception;
-use RetailCrm\Model\Response\Body\ErrorResponseBody;
+use RetailCrm\Model\Response\ErrorResponseBody;
use Throwable;
/**
@@ -41,7 +41,7 @@ class TopApiException extends Exception
/**
* TopApiException constructor.
*
- * @param \RetailCrm\Model\Response\Body\ErrorResponseBody $responseBody
+ * @param \RetailCrm\Model\Response\ErrorResponseBody $responseBody
* @param string|null $requestId
* @param \Throwable|null $previous
*/
diff --git a/src/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitor.php b/src/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitor.php
index ff0606b..ec1cd45 100644
--- a/src/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitor.php
+++ b/src/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitor.php
@@ -195,8 +195,9 @@ class JsonDeserializationVisitor extends AbstractVisitor implements Deserializat
if (in_array('InlineJsonBody', $metadata->groups ?? [])) {
if (!array_key_exists($metadata->serializedName, $data)) {
throw new RuntimeException(sprintf(
- 'Cannot find expected key in the data: %s',
- $metadata->serializedName
+ 'Cannot find expected key "%s" in the collection: %s',
+ $metadata->serializedName,
+ implode(', ', array_keys($data))
));
}
diff --git a/src/Factory/SerializerFactory.php b/src/Factory/SerializerFactory.php
index 8a1d956..793ce3a 100644
--- a/src/Factory/SerializerFactory.php
+++ b/src/Factory/SerializerFactory.php
@@ -22,6 +22,8 @@ use Psr\Container\ContainerInterface;
use RetailCrm\Component\Constants;
use RetailCrm\Component\JMS\Factory\JsonDeserializationVisitorFactory;
use RetailCrm\Interfaces\FactoryInterface;
+use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
+use JMS\Serializer\Expression\ExpressionEvaluator;
/**
* Class SerializerFactory
@@ -138,6 +140,7 @@ class SerializerFactory implements FactoryInterface
->setSerializationVisitor('json', new JsonSerializationVisitorFactory())
->setDeserializationVisitor('json', new JsonDeserializationVisitorFactory())
->setSerializationContextFactory(new SerializationContextFactory())
+ ->setExpressionEvaluator(new ExpressionEvaluator(new ExpressionLanguage()))
->build();
}
}
diff --git a/src/Model/Entity/CategoryInfo.php b/src/Model/Entity/CategoryInfo.php
new file mode 100644
index 0000000..78c8e9f
--- /dev/null
+++ b/src/Model/Entity/CategoryInfo.php
@@ -0,0 +1,61 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Model\Entity;
+
+use JMS\Serializer\Annotation as JMS;
+
+/**
+ * Class CategoryInfo
+ *
+ * @category CategoryInfo
+ * @package RetailCrm\Model\Entity
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class CategoryInfo
+{
+ /**
+ * @var int $childrenCategoryId
+ *
+ * @JMS\Type("int")
+ * @JMS\SerializedName("children_category_id")
+ */
+ public $childrenCategoryId;
+
+ /**
+ * @var bool $isLeafCategory
+ *
+ * @JMS\Type("bool")
+ * @JMS\SerializedName("is_leaf_category")
+ */
+ public $isLeafCategory;
+
+ /**
+ * @var int $level
+ *
+ * @JMS\Type("int")
+ * @JMS\SerializedName("level")
+ */
+ public $level;
+
+ /**
+ * @var array $multiLanguageNames
+ *
+ * @JMS\Type("array")
+ * @JMS\SerializedName("multi_language_names")
+ * @JMS\Groups(groups={"InlineJsonBody"})
+ */
+ public $multiLanguageNames;
+}
diff --git a/src/Model/Request/AliExpressSolution/SellerCategoryTreeQuery.php b/src/Model/Request/AliExpressSolution/SellerCategoryTreeQuery.php
new file mode 100644
index 0000000..7521d51
--- /dev/null
+++ b/src/Model/Request/AliExpressSolution/SellerCategoryTreeQuery.php
@@ -0,0 +1,66 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Model\Request\AliExpressSolution;
+
+use RetailCrm\Model\Request\BaseRequest;
+use JMS\Serializer\Annotation as JMS;
+use RetailCrm\Model\Response\AliExpressSolution\SellerCategoryTreeQueryResponse;
+use Symfony\Component\Validator\Constraints as Assert;
+
+/**
+ * Class SellerCategoryTreeQuery
+ *
+ * @category SellerCategoryTreeQuery
+ * @package RetailCrm\Model\Request\AliExpressSolution
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class SellerCategoryTreeQuery extends BaseRequest
+{
+ /**
+ * @var int $categoryId
+ *
+ * @JMS\Type("int")
+ * @JMS\SerializedName("category_id")
+ * @Assert\NotBlank()
+ * @Assert\PositiveOrZero()
+ */
+ public $categoryId;
+
+ /**
+ * @var bool $filterNoPermission
+ *
+ * @JMS\Type("bool")
+ * @JMS\SerializedName("filter_no_permission")
+ * @Assert\NotNull()
+ */
+ public $filterNoPermission = false;
+
+ /**
+ * @inheritDoc
+ */
+ public function getMethod(): string
+ {
+ return 'aliexpress.solution.seller.category.tree.query';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getExpectedResponse(): string
+ {
+ return SellerCategoryTreeQueryResponse::class;
+ }
+}
diff --git a/src/Model/Request/BaseRequest.php b/src/Model/Request/BaseRequest.php
index edbfaab..af42707 100644
--- a/src/Model/Request/BaseRequest.php
+++ b/src/Model/Request/BaseRequest.php
@@ -91,7 +91,7 @@ abstract class BaseRequest
*
* @JMS\Type("bool")
* @JMS\SerializedName("simplify")
- * @JMS\Accessor(getter="isSimplify")
+ * @JMS\Exclude(if="!object.simplify")
*/
public $simplify = false;
@@ -132,14 +132,6 @@ abstract class BaseRequest
$this->method = $this->getMethod();
}
- /**
- * @return bool|null
- */
- public function isSimplify(): ?bool
- {
- return $this->simplify ? true : null;
- }
-
/**
* @param string $method
*
diff --git a/src/Model/Request/HttpDnsGetRequest.php b/src/Model/Request/Taobao/HttpDnsGetRequest.php
similarity index 80%
rename from src/Model/Request/HttpDnsGetRequest.php
rename to src/Model/Request/Taobao/HttpDnsGetRequest.php
index 6f60ebb..3f442af 100644
--- a/src/Model/Request/HttpDnsGetRequest.php
+++ b/src/Model/Request/Taobao/HttpDnsGetRequest.php
@@ -4,21 +4,22 @@
* PHP version 7.3
*
* @category HttpDnsGetRequest
- * @package RetailCrm\Model\Request
+ * @package RetailCrm\Model\Request\Taobao
* @author RetailCRM
* @license MIT https://mit-license.org
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
-namespace RetailCrm\Model\Request;
+namespace RetailCrm\Model\Request\Taobao;
-use RetailCrm\Model\Response\HttpDnsGetResponse;
+use RetailCrm\Model\Request\BaseRequest;
+use RetailCrm\Model\Response\Taobao\HttpDnsGetResponse;
/**
* Class HttpDnsGetRequest
*
* @category HttpDnsGetRequest
- * @package RetailCrm\Model\Request
+ * @package RetailCrm\Model\Request\Taobao
* @author RetailDriver LLC
* @license MIT https://mit-license.org
* @link http://retailcrm.ru
diff --git a/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseData.php b/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseData.php
new file mode 100644
index 0000000..2025fff
--- /dev/null
+++ b/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseData.php
@@ -0,0 +1,44 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Model\Response\AliExpressSolution\Data;
+
+use JMS\Serializer\Annotation as JMS;
+
+/**
+ * Class SellerCategoryTreeQueryResponseData
+ *
+ * @category SellerCategoryTreeQueryResponseData
+ * @package RetailCrm\Model\Response\AliExpressSolution\Data
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class SellerCategoryTreeQueryResponseData
+{
+ /**
+ * @var SellerCategoryTreeQueryResponseDataChildrenCategoryList
+ *
+ * @JMS\Type("RetailCrm\Model\Response\AliExpressSolution\Data\SellerCategoryTreeQueryResponseDataChildrenCategoryList")
+ * @JMS\SerializedName("children_category_list")
+ */
+ public $childrenCategoryList;
+
+ /**
+ * @var bool $isSuccess
+ *
+ * @JMS\Type("bool")
+ * @JMS\SerializedName("is_success")
+ */
+ public $isSuccess;
+}
diff --git a/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseDataChildrenCategoryList.php b/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseDataChildrenCategoryList.php
new file mode 100644
index 0000000..5d78968
--- /dev/null
+++ b/src/Model/Response/AliExpressSolution/Data/SellerCategoryTreeQueryResponseDataChildrenCategoryList.php
@@ -0,0 +1,37 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Model\Response\AliExpressSolution\Data;
+
+use RetailCrm\Model\Entity\CategoryInfo;
+use JMS\Serializer\Annotation as JMS;
+
+/**
+ * Class SellerCategoryTreeQueryResponseDataChildrenCategoryList
+ *
+ * @category SellerCategoryTreeQueryResponseDataChildrenCategoryList
+ * @package RetailCrm\Model\Response\AliExpressSolution\Data
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class SellerCategoryTreeQueryResponseDataChildrenCategoryList
+{
+ /**
+ * @var CategoryInfo[] $categoryInfo
+ *
+ * @JMS\Type("array")
+ * @JMS\SerializedName("category_info")
+ */
+ public $categoryInfo;
+}
diff --git a/src/Model/Response/AliExpressSolution/SellerCategoryTreeQueryResponse.php b/src/Model/Response/AliExpressSolution/SellerCategoryTreeQueryResponse.php
new file mode 100644
index 0000000..e854b85
--- /dev/null
+++ b/src/Model/Response/AliExpressSolution/SellerCategoryTreeQueryResponse.php
@@ -0,0 +1,38 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Model\Response\AliExpressSolution;
+
+use RetailCrm\Model\Response\BaseResponse;
+
+use JMS\Serializer\Annotation as JMS;
+
+/**
+ * Class SellerCategoryTreeQueryResponse
+ *
+ * @category SellerCategoryTreeQueryResponse
+ * @package RetailCrm\Model\Response\AliExpressSolution
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class SellerCategoryTreeQueryResponse extends BaseResponse
+{
+ /**
+ * @var \RetailCrm\Model\Response\AliExpressSolution\Data\SellerCategoryTreeQueryResponseData $responseData
+ *
+ * @JMS\Type("RetailCrm\Model\Response\AliExpressSolution\Data\SellerCategoryTreeQueryResponseData")
+ * @JMS\SerializedName("aliexpress_solution_seller_category_tree_query_response")
+ */
+ public $responseData;
+}
diff --git a/src/Model/Response/BaseResponse.php b/src/Model/Response/BaseResponse.php
index 888a5b8..76d8a2f 100644
--- a/src/Model/Response/BaseResponse.php
+++ b/src/Model/Response/BaseResponse.php
@@ -27,9 +27,9 @@ use JMS\Serializer\Annotation as JMS;
class BaseResponse implements TopResponseInterface
{
/**
- * @var \RetailCrm\Model\Response\Body\ErrorResponseBody
+ * @var \RetailCrm\Model\Response\ErrorResponseBody
*
- * @JMS\Type("RetailCrm\Model\Response\Body\ErrorResponseBody")
+ * @JMS\Type("RetailCrm\Model\Response\ErrorResponseBody")
* @JMS\SerializedName("error_response")
*/
public $errorResponse;
diff --git a/src/Model/Response/Body/ErrorResponseBody.php b/src/Model/Response/ErrorResponseBody.php
similarity index 87%
rename from src/Model/Response/Body/ErrorResponseBody.php
rename to src/Model/Response/ErrorResponseBody.php
index f7c07f8..8959c0a 100644
--- a/src/Model/Response/Body/ErrorResponseBody.php
+++ b/src/Model/Response/ErrorResponseBody.php
@@ -4,13 +4,13 @@
* PHP version 7.3
*
* @category ErrorResponseBody
- * @package RetailCrm\Model\Response\Body
+ * @package RetailCrm\Model\Response
* @author RetailCRM
* @license MIT
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
-namespace RetailCrm\Model\Response\Body;
+namespace RetailCrm\Model\Response;
use JMS\Serializer\Annotation as JMS;
@@ -18,7 +18,7 @@ use JMS\Serializer\Annotation as JMS;
* Class ErrorResponseBody
*
* @category ErrorResponseBody
- * @package RetailCrm\Model\Response\Body
+ * @package RetailCrm\Model\Response
* @author RetailDriver LLC
* @license MIT
* @link http://retailcrm.ru
diff --git a/src/Model/Response/Data/HttpDnsGetResponseData.php b/src/Model/Response/Taobao/Data/HttpDnsGetResponseData.php
similarity index 69%
rename from src/Model/Response/Data/HttpDnsGetResponseData.php
rename to src/Model/Response/Taobao/Data/HttpDnsGetResponseData.php
index 327ebc5..4a88d66 100644
--- a/src/Model/Response/Data/HttpDnsGetResponseData.php
+++ b/src/Model/Response/Taobao/Data/HttpDnsGetResponseData.php
@@ -4,22 +4,22 @@
* PHP version 7.3
*
* @category HttpDnsGetResponseData
- * @package RetailCrm\Model\Response\Data
+ * @package RetailCrm\Model\Response\Taobao\Data
* @author RetailCRM
* @license MIT
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
-namespace RetailCrm\Model\Response\Data;
+namespace RetailCrm\Model\Response\Taobao\Data;
use JMS\Serializer\Annotation as JMS;
-use RetailCrm\Model\Response\Body\InlineJsonBody\HttpDnsGetResponseResult;
+use RetailCrm\Model\Response\Taobao\Result\HttpDnsGetResponseResult;
/**
* Class HttpDnsGetResponseData
*
* @category HttpDnsGetResponseData
- * @package RetailCrm\Model\Response\Data
+ * @package RetailCrm\Model\Response\Taobao\Data
* @author RetailDriver LLC
* @license MIT
* @link http://retailcrm.ru
@@ -30,7 +30,7 @@ class HttpDnsGetResponseData
/**
* @var HttpDnsGetResponseResult $result
*
- * @JMS\Type("RetailCrm\Model\Response\Body\InlineJsonBody\HttpDnsGetResponseResult")
+ * @JMS\Type("RetailCrm\Model\Response\Taobao\Result\HttpDnsGetResponseResult")
* @JMS\SerializedName("result")
* @JMS\Groups(groups={"InlineJsonBody"})
*/
diff --git a/src/Model/Response/HttpDnsGetResponse.php b/src/Model/Response/Taobao/HttpDnsGetResponse.php
similarity index 64%
rename from src/Model/Response/HttpDnsGetResponse.php
rename to src/Model/Response/Taobao/HttpDnsGetResponse.php
index 546f16d..45d7565 100644
--- a/src/Model/Response/HttpDnsGetResponse.php
+++ b/src/Model/Response/Taobao/HttpDnsGetResponse.php
@@ -4,21 +4,22 @@
* PHP version 7.3
*
* @category HttpDnsGetResponse
- * @package RetailCrm\Model\Response
+ * @package RetailCrm\Model\Response\Taobao
* @author RetailCRM
* @license MIT
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
-namespace RetailCrm\Model\Response;
+namespace RetailCrm\Model\Response\Taobao;
use JMS\Serializer\Annotation as JMS;
+use RetailCrm\Model\Response\BaseResponse;
/**
* Class HttpDnsGetResponse
*
* @category HttpDnsGetResponse
- * @package RetailCrm\Model\Response
+ * @package RetailCrm\Model\Response\Taobao
* @author RetailDriver LLC
* @license MIT
* @link http://retailcrm.ru
@@ -27,9 +28,9 @@ use JMS\Serializer\Annotation as JMS;
class HttpDnsGetResponse extends BaseResponse
{
/**
- * @var \RetailCrm\Model\Response\Data\HttpDnsGetResponseData $responseData
+ * @var \RetailCrm\Model\Response\Taobao\Data\HttpDnsGetResponseData $responseData
*
- * @JMS\Type("RetailCrm\Model\Response\Data\HttpDnsGetResponseData")
+ * @JMS\Type("RetailCrm\Model\Response\Taobao\Data\HttpDnsGetResponseData")
* @JMS\SerializedName("httpdns_get_response")
*/
public $responseData;
diff --git a/src/Model/Response/Body/InlineJsonBody/HttpDnsGetResponseResult.php b/src/Model/Response/Taobao/Result/HttpDnsGetResponseResult.php
similarity index 81%
rename from src/Model/Response/Body/InlineJsonBody/HttpDnsGetResponseResult.php
rename to src/Model/Response/Taobao/Result/HttpDnsGetResponseResult.php
index 35c1587..c1d5c34 100644
--- a/src/Model/Response/Body/InlineJsonBody/HttpDnsGetResponseResult.php
+++ b/src/Model/Response/Taobao/Result/HttpDnsGetResponseResult.php
@@ -4,13 +4,13 @@
* PHP version 7.3
*
* @category HttpDnsGetResponseResult
- * @package RetailCrm\Model\Response\Body\InlineJsonBody
+ * @package RetailCrm\Model\Response\Taobao\Result
* @author RetailCRM
* @license MIT
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
-namespace RetailCrm\Model\Response\Body\InlineJsonBody;
+namespace RetailCrm\Model\Response\Taobao\Result;
use JMS\Serializer\Annotation as JMS;
@@ -18,7 +18,7 @@ use JMS\Serializer\Annotation as JMS;
* Class HttpDnsGetResponseResult
*
* @category HttpDnsGetResponseResult
- * @package RetailCrm\Model\Response\Body\InlineJsonBody
+ * @package RetailCrm\Model\Response\Taobao\Result
* @author RetailDriver LLC
* @license MIT
* @link http://retailcrm.ru
diff --git a/tests/RetailCrm/Test/TestCase.php b/tests/RetailCrm/Test/TestCase.php
index 8a524d1..f12d47e 100644
--- a/tests/RetailCrm/Test/TestCase.php
+++ b/tests/RetailCrm/Test/TestCase.php
@@ -13,13 +13,11 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use RetailCrm\Builder\ContainerBuilder;
use RetailCrm\Component\AppData;
-use RetailCrm\Component\Authenticator\TokenAuthenticator;
use RetailCrm\Component\Constants;
use RetailCrm\Component\Environment;
use RetailCrm\Component\Logger\StdoutLogger;
use RetailCrm\Factory\FileItemFactory;
use RetailCrm\Interfaces\AppDataInterface;
-use RetailCrm\Interfaces\AuthenticatorInterface;
use RetailCrm\Interfaces\FileItemFactoryInterface;
/**
diff --git a/tests/RetailCrm/Tests/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitorTest.php b/tests/RetailCrm/Tests/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitorTest.php
new file mode 100644
index 0000000..a63a90a
--- /dev/null
+++ b/tests/RetailCrm/Tests/Component/JMS/Visitor/Deserialization/JsonDeserializationVisitorTest.php
@@ -0,0 +1,92 @@
+
+ * @license http://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see http://help.retailcrm.ru
+ */
+
+namespace RetailCrm\Tests\Component\JMS\Visitor\Deserialization;
+
+use RetailCrm\Component\Constants;
+use RetailCrm\Model\Entity\CategoryInfo;
+use RetailCrm\Model\Response\AliExpressSolution\Data\SellerCategoryTreeQueryResponseData;
+use RetailCrm\Model\Response\AliExpressSolution\Data\SellerCategoryTreeQueryResponseDataChildrenCategoryList;
+use RetailCrm\Model\Response\AliExpressSolution\SellerCategoryTreeQueryResponse;
+use RetailCrm\Test\TestCase;
+
+/**
+ * Class JsonDeserializationVisitorTest
+ *
+ * @category JsonDeserializationVisitorTest
+ * @package RetailCrm\Tests\Component\JMS\Visitor\Deserialization
+ * @author RetailDriver LLC
+ * @license https://retailcrm.ru Proprietary
+ * @link http://retailcrm.ru
+ * @see https://help.retailcrm.ru
+ */
+class JsonDeserializationVisitorTest extends TestCase
+{
+ public function testDeserializeInlineJson()
+ {
+ $json = <<<'EOF'
+{
+ "aliexpress_solution_seller_category_tree_query_response":{
+ "children_category_list":{
+ "category_info":[
+ {
+ "children_category_id":5090301,
+ "is_leaf_category":true,
+ "level":2,
+ "multi_language_names":"{ \"de\": \"Mobiltelefon\", \"ru\": \"Мобильные телефоны\", \"pt\": \"Telefonia\", \"in\": \"Ponsel\", \"en\": \"Mobile Phones\", \"it\": \"Telefoni cellulari\", \"fr\": \"Smartphones\", \"es\": \"Smartphones\", \"tr\": \"Cep Telefonu\", \"nl\": \"Mobiele telefoons\" }"
+ }
+ ]
+ },
+ "is_success":true
+ }
+}
+EOF;
+ $expectedLangs = [
+ 'de' => 'Mobiltelefon',
+ 'ru' => 'Мобильные телефоны',
+ 'pt' => 'Telefonia',
+ 'in' => 'Ponsel',
+ 'en' => 'Mobile Phones',
+ 'it' => 'Telefoni cellulari',
+ 'fr' => 'Smartphones',
+ 'es' => 'Smartphones',
+ 'tr' => 'Cep Telefonu',
+ 'nl' => 'Mobiele telefoons'
+ ];
+
+ /** @var \JMS\Serializer\SerializerInterface $serializer */
+ $serializer = $this->getContainer()->get(Constants::SERIALIZER);
+ /** @var SellerCategoryTreeQueryResponse $result */
+ $result = $serializer->deserialize($json, SellerCategoryTreeQueryResponse::class, 'json');
+
+ self::assertInstanceOf(SellerCategoryTreeQueryResponseData::class, $result->responseData);
+ self::assertInstanceOf(
+ SellerCategoryTreeQueryResponseDataChildrenCategoryList::class,
+ $result->responseData->childrenCategoryList
+ );
+ self::assertIsArray($result->responseData->childrenCategoryList->categoryInfo);
+ self::assertCount(1, $result->responseData->childrenCategoryList->categoryInfo);
+
+ $info = $result->responseData->childrenCategoryList->categoryInfo[0];
+
+ self::assertInstanceOf(CategoryInfo::class, $info);
+ self::assertEquals(5090301, $info->childrenCategoryId);
+ self::assertTrue($info->isLeafCategory);
+ self::assertEquals(2, $info->level);
+ self::assertIsArray($info->multiLanguageNames);
+
+ foreach ($expectedLangs as $lang => $value) {
+ self::assertArrayHasKey($lang, $info->multiLanguageNames);
+ self::assertEquals($value, $info->multiLanguageNames[$lang]);
+ }
+ }
+}
diff --git a/tests/RetailCrm/Tests/Factory/TopRequestFactoryTest.php b/tests/RetailCrm/Tests/Factory/TopRequestFactoryTest.php
index 0ee5a22..c892b2f 100644
--- a/tests/RetailCrm/Tests/Factory/TopRequestFactoryTest.php
+++ b/tests/RetailCrm/Tests/Factory/TopRequestFactoryTest.php
@@ -42,6 +42,7 @@ class TopRequestFactoryTest extends TestCase
self::assertEmpty($contents);
self::assertNotEmpty($uri->getQuery());
+ self::assertFalse(stripos($uri->getQuery(), 'simplify'), $uri->getQuery());
self::assertNotFalse(stripos($uri->getQuery(), 'SPAIN_LOCAL_CORREOS'));
}
diff --git a/tests/RetailCrm/Tests/TopClient/ClientTest.php b/tests/RetailCrm/Tests/TopClient/ClientTest.php
index fc289f9..74aeeff 100644
--- a/tests/RetailCrm/Tests/TopClient/ClientTest.php
+++ b/tests/RetailCrm/Tests/TopClient/ClientTest.php
@@ -15,12 +15,9 @@ namespace RetailCrm\Tests\TopClient;
use Psr\Http\Message\RequestInterface;
use RetailCrm\Builder\ClientBuilder;
use RetailCrm\Component\AppData;
-use RetailCrm\Component\Authenticator\TokenAuthenticator;
-use RetailCrm\Component\Constants;
-use RetailCrm\Component\Exception\TopApiException;
-use RetailCrm\Model\Request\HttpDnsGetRequest;
+use RetailCrm\Model\Request\Taobao\HttpDnsGetRequest;
use RetailCrm\Model\Response\BaseResponse;
-use RetailCrm\Model\Response\Body\ErrorResponseBody;
+use RetailCrm\Model\Response\ErrorResponseBody;
use RetailCrm\Test\ClosureRequestMatcher;
use RetailCrm\Test\TestCase;