11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2016 Adobe
4+ * All Rights Reserved .
55 */
66namespace Magento \PageCache \Model \Layout ;
77
@@ -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
@@ -29,10 +29,15 @@ public function testLoadEntitySpecificHandleWithEsiBlock()
2929
3030 /** @var EntitySpecificHandlesList $entitySpecificHandleList */
3131 $ entitySpecificHandleList = $ objectManager ->get (EntitySpecificHandlesList::class);
32- // Add 'default' handle, which has declarations of blocks with ttl, to the list of entity specific handles.
33- // This allows to simulate a situation, when block with ttl attribute
34- // is declared e.g. in 'catalog_product_view_id_1' handle
35- $ entitySpecificHandleList ->addHandle ('default ' );
36- $ layoutMerge ->load (['default ' ]);
32+
33+ // Register test handle as entity-specific
34+ $ testHandle = 'default ' ;
35+ $ entitySpecificHandleList ->addHandle ($ testHandle );
36+
37+ // Simple XML with ttl attribute that should trigger the validation
38+ $ layoutXml = '<block class="Magento\Framework\View\Element\Template" name="test.block" ttl="3600"/> ' ;
39+
40+ // This should throw exception because the handle is entity-specific and contains ttl
41+ $ layoutMerge ->validateUpdate ($ testHandle , $ layoutXml );
3742 }
3843}
0 commit comments