|
8 | 8 | namespace Magento\GraphQl\Catalog;
|
9 | 9 |
|
10 | 10 | use Magento\Catalog\Api\Data\CategoryInterface;
|
| 11 | +use Magento\Catalog\Api\Data\ProductInterface; |
| 12 | +use Magento\Catalog\Api\ProductRepositoryInterface; |
11 | 13 | use Magento\Catalog\Model\CategoryRepository;
|
12 | 14 | use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
|
13 | 15 | use Magento\Framework\DataObject;
|
| 16 | +use Magento\TestFramework\ObjectManager; |
14 | 17 | use Magento\TestFramework\TestCase\GraphQl\ResponseContainsErrorsException;
|
15 | 18 | use Magento\TestFramework\TestCase\GraphQlAbstract;
|
16 |
| -use Magento\Catalog\Api\Data\ProductInterface; |
17 |
| -use Magento\Catalog\Api\ProductRepositoryInterface; |
18 |
| -use Magento\TestFramework\ObjectManager; |
19 | 19 |
|
20 | 20 | /**
|
21 | 21 | * Test loading of category tree
|
@@ -261,6 +261,25 @@ public function testGetDisabledCategory()
|
261 | 261 | $this->graphQlQuery($query);
|
262 | 262 | }
|
263 | 263 |
|
| 264 | + /** |
| 265 | + * @magentoApiDataFixture Magento/Catalog/_files/categories.php |
| 266 | + * @expectedException \Exception |
| 267 | + * @expectedExceptionMessage Category doesn't exist |
| 268 | + */ |
| 269 | + public function testGetCategoryIdZero() |
| 270 | + { |
| 271 | + $categoryId = 0; |
| 272 | + $query = <<<QUERY |
| 273 | +{ |
| 274 | + category(id: {$categoryId}) { |
| 275 | + id |
| 276 | + name |
| 277 | + } |
| 278 | +} |
| 279 | +QUERY; |
| 280 | + $this->graphQlQuery($query); |
| 281 | + } |
| 282 | + |
264 | 283 | public function testNonExistentCategoryWithProductCount()
|
265 | 284 | {
|
266 | 285 | $query = <<<QUERY
|
@@ -493,8 +512,7 @@ private function assertBaseFields($product, $actualResponse)
|
493 | 512 | ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
|
494 | 513 | ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
|
495 | 514 | ['response_field' => 'name', 'expected_value' => $product->getName()],
|
496 |
| - ['response_field' => 'price', 'expected_value' => |
497 |
| - [ |
| 515 | + ['response_field' => 'price', 'expected_value' => [ |
498 | 516 | 'minimalPrice' => [
|
499 | 517 | 'amount' => [
|
500 | 518 | 'value' => $product->getPrice(),
|
|
0 commit comments