Skip to content

Commit 21f168a

Browse files
committed
AC-14681: CNS WebApi Failed tests for 2.4.9-alpha1 for OpenSearch
Fix test failure related to indexing
1 parent 1bc2d6d commit 21f168a

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All rights reserved.
55
*/
66
declare(strict_types=1);
77

@@ -11,9 +11,15 @@
1111
use Magento\Catalog\Model\Indexer\Product\Category;
1212
use Magento\CatalogSearch\Model\Indexer\Fulltext as IndexerSearch;
1313
use Magento\Indexer\Model\Indexer;
14+
use Magento\Indexer\Test\Fixture\Indexer as IndexerFixture;
15+
use Magento\TestFramework\Fixture\Config;
1416
use Magento\TestFramework\Helper\Bootstrap;
1517
use Magento\TestFramework\ObjectManager;
1618
use Magento\TestFramework\TestCase\GraphQlAbstract;
19+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
20+
use Magento\TestFramework\Fixture\DataFixture;
21+
use Magento\TestFramework\Fixture\DataFixtureStorage;
22+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
1723

1824
/**
1925
* Test for getting canonical_url for products
@@ -23,23 +29,28 @@ class ProductCanonicalUrlTest extends GraphQlAbstract
2329
/** @var ObjectManager */
2430
private $objectManager;
2531

32+
/** @var DataFixtureStorage */
33+
private $fixtures;
34+
2635
/**
2736
* @inheritdoc
2837
*/
2938
protected function setUp(): void
3039
{
3140
$this->objectManager = Bootstrap::getObjectManager();
41+
$this->fixtures = DataFixtureStorageManager::getStorage();
3242
}
3343

34-
/**
35-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
36-
* @magentoConfigFixture default_store catalog/seo/product_canonical_tag 1
37-
*
38-
*/
44+
#[
45+
Config('catalog/seo/product_canonical_tag', 1),
46+
DataFixture(ProductFixture::class, as: 'product'),
47+
DataFixture(IndexerFixture::class)
48+
]
3949
public function testProductWithCanonicalLinksMetaTagSettingsEnabled()
4050
{
41-
$this->reindex();
42-
$productSku = 'simple';
51+
$product = DataFixtureStorageManager::getStorage()->get('product');
52+
$productSku = $product->getSku();
53+
$productCanonicalUrl = $product->getUrlKey();
4354
$query
4455
= <<<QUERY
4556
{
@@ -57,10 +68,10 @@ public function testProductWithCanonicalLinksMetaTagSettingsEnabled()
5768
$this->assertNotEmpty($response['products']['items']);
5869

5970
$this->assertEquals(
60-
'simple-product.html',
71+
$productCanonicalUrl . '.html',
6172
$response['products']['items'][0]['canonical_url']
6273
);
63-
$this->assertEquals('simple', $response['products']['items'][0]['sku']);
74+
$this->assertEquals($productSku, $response['products']['items'][0]['sku']);
6475
}
6576

6677
/**

0 commit comments

Comments
 (0)