/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Test/Integrity/DatabaseTest.php
36 строк
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2016 Adobe * All Rights Reserved. */ namespace Magento\Test\Integrity; use Magento\TestFramework\Helper\Bootstrap; class DatabaseTest extends \PHPUnit\Framework\TestCase { /** * Assure that there are no redundant indexes declared in database */ public function testDuplicateKeys() { if (!defined('PERCONA_TOOLKIT_BIN_DIR')) { $this->markTestSkipped('Path to Percona Toolkit is not specified.'); } $checkerPath = PERCONA_TOOLKIT_BIN_DIR . '/pt-duplicate-key-checker'; $db = Bootstrap::getInstance()->getBootstrap()->getApplication()->getDbInstance(); $command = $checkerPath . ' -d ' . $db->getSchema() . ' h=' . $db->getHost()['db-host'] . ',u=' . $db->getUser() . ',p=' . $db->getPassword(); // exec() have to be here since this is test. // phpcs:ignore Magento2.Security.InsecureFunction exec($command, $output, $exitCode); $this->assertEquals(0, $exitCode); $output = implode(PHP_EOL, $output); if (preg_match('/Total Duplicate Indexes\s+(\d+)/', $output, $matches)) { $this->fail($matches[1] . ' duplicate indexes found.' . PHP_EOL . PHP_EOL . $output); } } }