6 declare(strict_types=1);
10 use Symfony\Component\Console\Tester\CommandTester;
34 private $componentRegistrar;
39 private $objectManager;
49 private $moduleManager;
57 $this->command = $this->objectManager->create(
58 \
Magento\Developer\Console\Command\TablesWhitelistGenerateCommand::class
60 $this->componentRegistrar = $this->objectManager->create(
61 \
Magento\Framework\Component\ComponentRegistrar::class
63 $this->cliCommand = $this->objectManager->get(CliCommand::class);
64 $this->tester =
new CommandTester($this->command);
65 $this->moduleManager = $this->objectManager->get(TestModuleManager::class);
78 'Magento_TestSetupDeclarationModule1',
79 'Magento_TestSetupDeclarationModule8',
82 $this->cliCommand->install($modules);
83 foreach ($modules as $moduleName) {
84 $this->moduleManager->updateRevision(
92 foreach ($modules as $moduleName) {
93 $this->checkWhitelistFile($moduleName);
100 private function checkWhitelistFile(
string $moduleName)
102 $modulePath = $this->componentRegistrar->getPath(
'module', $moduleName);
103 $whiteListFileName = $modulePath
104 . DIRECTORY_SEPARATOR
106 . DIRECTORY_SEPARATOR
110 $this->tester->execute([
'--module-name' => $moduleName], [
'interactive' =>
false]);
113 $this->assertFileExists($whiteListFileName);
114 $this->assertContains(
'', $this->tester->getDisplay());
119 . DIRECTORY_SEPARATOR
125 str_replace(
'Magento_',
'', $moduleName),
126 'db_schema_whitelist.json' 130 $this->assertEquals($expectedWhitelistContent, $whitelistFileContent);
const GENERATED_WHITELIST_FILE_NAME
defined('TESTS_BP')||define('TESTS_BP' __DIR__
static getObjectManager()