Skip to content

Commit d8a6082

Browse files
committed
MAGETWO-88814: [Performance] Some indexes become recreated on db with prefixes
1 parent 285c535 commit d8a6082

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
namespace Magento\Setup\Declaration;
99

10+
use Magento\Framework\App\ResourceConnection;
1011
use Magento\Framework\App\Utility\Files;
1112
use Magento\Framework\Component\ComponentRegistrar;
1213
use Magento\Framework\Component\ComponentRegistrarInterface;
14+
use Magento\Framework\ObjectManagerInterface;
1315
use Magento\Framework\Setup\Declaration\Schema\Dto\Constraint;
1416
use Magento\Framework\Setup\Declaration\Schema\Dto\Index;
15-
use Magento\Framework\Setup\Declaration\Schema\Dto\Schema;
1617
use Magento\Framework\Setup\Declaration\Schema\SchemaConfigInterface;
1718
use Magento\TestFramework\Helper\Bootstrap;
19+
use Magento\TestFramework\ObjectManager;
1820

1921
/**
2022
* Class WhitelistDeclarationTest
@@ -25,31 +27,37 @@ class WhitelistDeclarationTest extends \PHPUnit\Framework\TestCase
2527
* @var ComponentRegistrarInterface
2628
*/
2729
private $componentRegistrar;
30+
2831
/**
29-
* @var Schema
32+
* @var SchemaConfigInterface
3033
*/
31-
private $declarativeSchema;
34+
private $schemaConfig;
3235

3336
public function setUp()
3437
{
38+
/** @var ObjectManagerInterface|ObjectManager $objectManager */
3539
$objectManager = Bootstrap::getObjectManager();
36-
$schemaConfig = $objectManager->get(SchemaConfigInterface::class);
37-
$this->declarativeSchema = $schemaConfig->getDeclarationConfig();
40+
$resourceConnection = $objectManager->create(ResourceConnection::class);
41+
$objectManager->removeSharedInstance(ResourceConnection::class);
42+
$objectManager->addSharedInstance($resourceConnection, ResourceConnection::class);
3843
$this->componentRegistrar = $objectManager->get(ComponentRegistrarInterface::class);
44+
$this->schemaConfig = $objectManager->create(SchemaConfigInterface::class);
3945
}
4046

4147
/**
4248
* Checks that all declared table elements also declared into whitelist declaration.
4349
*
50+
* @appIsolation
4451
* @throws \Exception
4552
*/
4653
public function testConstraintsAndIndexesAreWhitelisted()
4754
{
4855
$undeclaredElements = [];
4956
$resultMessage = "New table elements that do not exist in the whitelist declaration:\n";
5057
$whitelistTables = $this->getWhiteListTables();
58+
$declarativeSchema = $this->schemaConfig->getDeclarationConfig();
5159

52-
foreach ($this->declarativeSchema->getTables() as $schemaTable) {
60+
foreach ($declarativeSchema->getTables() as $schemaTable) {
5361
$tableNameWithoutPrefix = $schemaTable->getNameWithoutPrefix();
5462
foreach ($schemaTable->getConstraints() as $constraint) {
5563
$constraintNameWithoutPrefix = $constraint->getNameWithoutPrefix();

0 commit comments

Comments
 (0)