Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
DatabaseTest Class Reference
Inheritance diagram for DatabaseTest:

Public Member Functions

 testDuplicateKeys ()
 

Detailed Description

Definition at line 11 of file DatabaseTest.php.

Member Function Documentation

◆ testDuplicateKeys()

testDuplicateKeys ( )

Assure that there are no redundant indexes declared in database

Definition at line 16 of file DatabaseTest.php.

17  {
18  if (!defined('PERCONA_TOOLKIT_BIN_DIR')) {
19  $this->markTestSkipped('Path to Percona Toolkit is not specified.');
20  }
21  $checkerPath = PERCONA_TOOLKIT_BIN_DIR . '/pt-duplicate-key-checker';
22 
23  $db = Bootstrap::getInstance()->getBootstrap()->getApplication()->getDbInstance();
24  $command = $checkerPath . ' -d ' . $db->getSchema()
25  . ' h=' . $db->getHost()['db-host'] . ',u=' . $db->getUser() . ',p=' . $db->getPassword();
26 
27  exec($command, $output, $exitCode);
28  $this->assertEquals(0, $exitCode);
29  $output = implode(PHP_EOL, $output);
30  if (preg_match('/Total Duplicate Indexes\s+(\d+)/', $output, $matches)) {
31  $this->fail($matches[1] . ' duplicate indexes found.' . PHP_EOL . PHP_EOL . $output);
32  }
33  }
exec($command, array &$output=null, &$return_var=null)

The documentation for this class was generated from the following file: