-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.4-develop' into queue-exchange-argument-processor-fix
- Loading branch information
Showing
41 changed files
with
1,239 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...ode/Magento/Catalog/Test/Unit/Model/Indexer/Category/Product/Plugin/TableResolverTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\Test\Unit\Model\Indexer\Category\Product\Plugin; | ||
|
||
use Magento\Catalog\Model\Indexer\Category\Product\Plugin\TableResolver; | ||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver; | ||
use Magento\Store\Model\Store; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class TableResolverTest extends TestCase | ||
{ | ||
/** | ||
* Tests replacing catalog_category_product_index table name | ||
* | ||
* @param int $storeId | ||
* @param string $tableName | ||
* @param string $expected | ||
* @dataProvider afterGetTableNameDataProvider | ||
*/ | ||
public function testAfterGetTableName(int $storeId, string $tableName, string $expected): void | ||
{ | ||
$storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class); | ||
|
||
$storeMock = $this->getMockBuilder(Store::class) | ||
->onlyMethods(['getId']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$storeMock->method('getId') | ||
->willReturn($storeId); | ||
|
||
$storeManagerMock->method('getStore')->willReturn($storeMock); | ||
|
||
$tableResolverMock = $this->getMockBuilder(IndexScopeResolver::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$tableResolverMock->method('resolve')->willReturn('catalog_category_product_index_store1'); | ||
|
||
$subjectMock = $this->getMockBuilder(ResourceConnection::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$model = new TableResolver($storeManagerMock, $tableResolverMock); | ||
|
||
$this->assertEquals( | ||
$expected, | ||
$model->afterGetTableName($subjectMock, $tableName, 'catalog_category_product_index') | ||
); | ||
} | ||
|
||
/** | ||
* Data provider for testAfterGetTableName | ||
* | ||
* @return array | ||
*/ | ||
public function afterGetTableNameDataProvider(): array | ||
{ | ||
return [ | ||
[ | ||
'storeId' => 1, | ||
'tableName' => 'catalog_category_product_index', | ||
'expected' => 'catalog_category_product_index_store1' | ||
], | ||
[ | ||
'storeId' => 0, | ||
'tableName' => 'catalog_category_product_index', | ||
'expected' => 'catalog_category_product_index' | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.