Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LayoutTestWithExceptions.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Framework\View;
7 
8 use \Magento\Framework\App\State;
9 
10 class LayoutTestWithExceptions extends \PHPUnit\Framework\TestCase
11 {
15  protected $layout;
16 
17  public function setUp()
18  {
20  $layoutFactory = $objectManager->get(\Magento\Framework\View\LayoutFactory::class);
21  $this->layout = $layoutFactory->create();
22  $layoutElement = new \Magento\Framework\View\Layout\Element(
23  __DIR__ . '/_files/layout_with_exceptions/layout.xml',
24  0,
25  true
26  );
27 
28  $this->layout->setXml($layoutElement);
29  $objectManager->get(\Magento\Framework\App\Cache\Type\Layout::class)->clean();
30  }
31 
37  {
38  $this->layout->generateElements();
39  }
40 
44  public function testProcessWithExceptions()
45  {
47  ->setMode(State::MODE_DEFAULT);
48 
49  $this->layout->generateElements();
50 
51  $this->layout->addOutputElement('block.with.broken.constructor');
52  $this->layout->addOutputElement('block.with.broken.layout');
53  $this->layout->addOutputElement('block.with.broken.action');
54 
55  $this->assertEmpty($this->layout->getOutput());
56  }
57 }
$objectManager
Definition: bootstrap.php:17
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60