@@ -15,7 +15,7 @@ class MergeTest extends \PHPUnit\Framework\TestCase
1515 public function testLoadEntitySpecificHandleWithEsiBlock ()
1616 {
1717 $ this ->expectException (\LogicException::class);
18- $ this ->expectExceptionMessage ('Handle \' default \' must not contain blocks with \'ttl \' attribute specified ' );
18+ $ this ->expectExceptionMessage ('must not contain blocks with \'ttl \' attribute specified ' );
1919
2020 $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
2121
@@ -30,19 +30,25 @@ public function testLoadEntitySpecificHandleWithEsiBlock()
3030 /** @var EntitySpecificHandlesList $entitySpecificHandleList */
3131 $ entitySpecificHandleList = $ objectManager ->get (EntitySpecificHandlesList::class);
3232
33- // Register test layout file with ttl attribute
34- $ testHandle = 'test_layout_with_ttl ' ;
33+ // Register test layout with ttl attribute
34+ $ testHandle = 'test_entity_specific_handle ' ;
3535
3636 // Add this handle to entity-specific list to trigger validation
3737 $ entitySpecificHandleList ->addHandle ($ testHandle );
3838
39- // Manually add the layout XML from test fixture
40- $ layoutXml = file_get_contents (__DIR__ . '/../../_files/test_layout_with_ttl.xml ' );
39+ // Layout XML with ttl attribute (without XML declaration to avoid parsing issues)
40+ $ layoutXml = <<<XML
41+ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
42+ <body>
43+ <block class="Magento\Framework\View\Element\Template" name="test.block.with.ttl" template="Magento_Theme::html/notices.phtml" ttl="3600"/>
44+ </body>
45+ </page>
46+ XML ;
47+
4148 $ layoutMerge ->addUpdate ($ layoutXml );
4249
43- // This throws exception when loading
44- // because test_layout_with_ttl is marked as entity-specific
45- // and contains a block with ttl
50+ // This should throw exception when loading because test_entity_specific_handle
51+ // is marked as entity-specific and contains a block with ttl
4652 $ layoutMerge ->load ([$ testHandle ]);
4753 }
4854}
0 commit comments