/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/setup-integration/testsuite/Magento/Setup/SchemaReaderTest.php
101 строка
3 KB
Dmytro Horytskyi
ACP2E-5094: Slow performance with MAGENTO_DC variables set under cloud UI
14 июл 2026, 05:43
14 июл 2026, 05:43
e8f8d30
Код
Авторство
О чём код?
<?php /** * Copyright 2017 Adobe * All Rights Reserved. */ namespace Magento\Setup; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\Setup\Declaration\Schema\Declaration\ReaderComposite; use Magento\TestFramework\Deploy\TestModuleManager; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\SetupTestCase; /** * The purpose of this test is validating schema reader operations. */ class SchemaReaderTest extends SetupTestCase { /** * @var \Magento\Framework\Setup\Declaration\Schema\FileSystem\XmlReader */ private $reader; /** * @var TestModuleManager */ private $moduleManager; /** * @var DeploymentConfig */ private $deploymentConfig; protected function setUp(): void { $objectManager = Bootstrap::getObjectManager(); $this->reader = $objectManager->get(ReaderComposite::class); $this->moduleManager = $objectManager->get(TestModuleManager::class); $this->deploymentConfig = $objectManager->get(DeploymentConfig::class); } /** * @moduleName Magento_TestSetupDeclarationModule1 * @dataProviderFromFile Magento/TestSetupDeclarationModule1/fixture/valid_xml_revision_1.php */ public function testSuccessfullRead() { $schema = $this->readSchema(); unset($schema['table']['patch_list']); self::assertEquals($this->getData(), $schema); } /** * Helper method. Decrease number of params * * @param string $revisionName * @return void */ private function updateRevisionTo($revisionName) { $this->moduleManager->updateRevision( 'Magento_TestSetupDeclarationModule1', $revisionName, TestModuleManager::DECLARATIVE_FILE_NAME, 'etc' ); } /** * @moduleName Magento_TestSetupDeclarationModule1 */ public function testFailOnInvalidColumnDeclaration() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $this->expectExceptionMessageMatches('/The attribute \'scale\' is not allowed./'); $this->updateRevisionTo('fail_on_column_declaration'); $this->readSchema(); } /** * @moduleName Magento_TestSetupDeclarationModule1 * @dataProviderFromFile Magento/TestSetupDeclarationModule1/fixture/foreign_key_interpreter_result.php */ public function testForeignKeyInterpreter() { $this->updateRevisionTo('foreign_key_interpreter'); $schema = $this->readSchema(); unset($schema['table']['patch_list']); self::assertEquals($this->getData(), $schema); } private function readSchema(): array { $this->deploymentConfig->resetData(); // data are already loaded when fixture is applied $schema = $this->reader->read('all'); return $schema; } }