Skip to content

Commit 849274c

Browse files
[ACQE-4664] Changing static error message to dynamic
1 parent c3c51bf commit 849274c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteDataTest.php renamed to dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteVisibilityTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66
declare(strict_types=1);
77

8+
namespace Magento\CatalogUrlRewrite\Model;
9+
810
use Magento\Catalog\Api\ProductRepositoryInterface;
9-
use Magento\CatalogUrlRewrite\Model\AbstractUrlRewriteTest;
1011
use Magento\CatalogUrlRewrite\Model\Map\DataProductUrlRewriteDatabaseMap;
11-
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator;
1212
use Magento\Store\Model\ScopeInterface;
1313
use Magento\TestFramework\Fixture\DataFixture;
1414
use Magento\Catalog\Model\Product\Visibility;
@@ -18,8 +18,9 @@
1818
* Class for product url rewrites tests
1919
*
2020
*/
21-
class ProductUrlRewriteDataTest extends AbstractUrlRewriteTest
21+
class ProductUrlRewriteVisibilityTest extends AbstractUrlRewriteTest
2222
{
23+
const URL_KEY_EMPTY_MESSAGE = 'Failed asserting URL key is empty for the given product';
2324

2425
/** @var string */
2526
private $suffix;
@@ -54,7 +55,7 @@ protected function setUp(): void
5455
public function testUrlRewriteOnInvisibleProductEdit(array $expectedData): void
5556
{
5657
$product = $this->productRepository->get('simple', true, 0, true);
57-
$this->assertUrlKeyEmpty($product);
58+
$this->assertUrlKeyEmpty($product, self::URL_KEY_EMPTY_MESSAGE);
5859

5960
//Update visibility and check the database entry
6061
$product->setVisibility(Visibility::VISIBILITY_BOTH);
@@ -71,7 +72,7 @@ public function testUrlRewriteOnInvisibleProductEdit(array $expectedData): void
7172
$product->setVisibility(Visibility::VISIBILITY_NOT_VISIBLE);
7273
$product = $this->productRepository->save($product);
7374

74-
$this->assertUrlKeyEmpty($product);
75+
$this->assertUrlKeyEmpty($product, self::URL_KEY_EMPTY_MESSAGE);
7576
}
7677

7778
/**
@@ -95,15 +96,14 @@ public function invisibleProductDataProvider(): array
9596
* Assert URL key is empty in database for the given product
9697
*
9798
* @param $product
99+
* @param string $message
100+
*
98101
* @return void
99102
*/
100-
public function assertUrlKeyEmpty($product): void
103+
public function assertUrlKeyEmpty($product, $message = ''): void
101104
{
102105
$productUrlRewriteItems = $this->getEntityRewriteCollection($product->getId())->getItems();
103-
$this->assertEmpty(
104-
$productUrlRewriteItems,
105-
'Failed asserting URL key is empty for the given product'
106-
);
106+
$this->assertEmpty($productUrlRewriteItems, $message);
107107
}
108108

109109
/**

0 commit comments

Comments
 (0)