Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 94fb609

Browse files
Correct docblocks, add api-functional test
1 parent d6c15d6 commit 94fb609

File tree

3 files changed

+9
-82
lines changed

3 files changed

+9
-82
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CanonicalUrl.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Magento\Framework\GraphQl\Query\ResolverInterface;
1515
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1616

17+
/**
18+
* Resolve data for product canonical URL
19+
*/
1720
class CanonicalUrl implements ResolverInterface
1821
{
1922
/**
@@ -31,15 +34,7 @@ public function __construct(
3134
}
3235

3336
/**
34-
* Fetches the data from persistence models and format it according to the GraphQL schema.
35-
*
36-
* @param \Magento\Framework\GraphQl\Config\Element\Field $field
37-
* @param $context
38-
* @param ResolveInfo $info
39-
* @param array|null $value
40-
* @param array|null $args
41-
* @throws \Exception
42-
* @return Value
37+
* {@inheritdoc}
4338
*/
4439
public function resolve(
4540
Field $field,

app/code/Magento/CatalogGraphQl/Test/Integration/Model/ProductsTest.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ public function testQueryAllFieldsSimpleProduct()
227227
updated_at
228228
url_key
229229
url_path
230+
canonical_url
230231
websites { id name code sort_order default_group_id is_default }
231232
... on PhysicalProductInterface {
232233
weight
@@ -272,6 +273,10 @@ public function testQueryAllFieldsSimpleProduct()
272273
'Filter category',
273274
$responseObject->getData('products/items/0/categories/2/name')
274275
);
276+
self::assertEquals(
277+
$product->getUrlModel()->getUrl($product, ['_ignore_category' => true, '_nosid' => true]),
278+
$responseObject->getData('products/items/0/canonical_url')
279+
);
275280
}
276281

277282
/**

0 commit comments

Comments
 (0)