/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php
71 строка
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ namespace Magento\Framework\View; use Magento\Framework\App\State; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Layout\Element; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; /** * Class to test Layout model functionality with exceptions */ class LayoutTestWithExceptions extends TestCase { /** * @var Layout */ protected $layout; /** * @inheritdoc */ protected function setUp(): void { $objectManager = Bootstrap::getObjectManager(); $layoutFactory = $objectManager->get(LayoutFactory::class); $this->layout = $layoutFactory->create(); $layoutElement = new Element( __DIR__ . '/_files/layout_with_exceptions/layout.xml', 0, true ); $this->layout->setXml($layoutElement); $objectManager->get(\Magento\Framework\App\Cache\Type\Layout::class)->clean(); } /** * Test to Create structure of elements from the loaded XML configuration with exception */ public function testProcessWithExceptionsDeveloperMode() { $this->expectException(LocalizedException::class); $this->expectExceptionMessage('Construction problem.'); $this->layout->generateElements(); } /** * Test to Get all blocks marked for output with exceptions * * @magentoAppIsolation enabled */ public function testProcessWithExceptions() { Bootstrap::getObjectManager()->get(State::class) ->setMode(State::MODE_DEFAULT); $this->layout->generateElements(); $this->layout->addOutputElement('block.with.broken.constructor'); $this->layout->addOutputElement('block.with.broken.layout'); $this->layout->addOutputElement('block.with.broken.action'); $this->assertEmpty($this->layout->getOutput()); } }