File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
dev/tests/static/testsuite/Magento/Test/Integrity/Layout Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Test block names exists
4
+ *
5
+ * Copyright © Magento, Inc. All rights reserved.
6
+ * See COPYING.txt for license details.
7
+ */
8
+
9
+ namespace Magento \Test \Integrity \Layout ;
10
+
11
+ class BlockNamesTest extends \PHPUnit \Framework \TestCase
12
+ {
13
+ public function testBlocksHasName ()
14
+ {
15
+ $ invoker = new \Magento \Framework \App \Utility \AggregateInvoker ($ this );
16
+ $ invoker (
17
+ /**
18
+ * Test validate that blocks without name doesn't exist in layout file
19
+ *
20
+ * @param string $layoutFile
21
+ */
22
+ function ($ layoutFile ) {
23
+ $ dom = new \DOMDocument ();
24
+ $ dom ->load ($ layoutFile );
25
+ $ xpath = new \DOMXpath ($ dom );
26
+ $ count = $ xpath ->query ('//block[not(@name)] ' )->length ;
27
+
28
+ if ($ count ) {
29
+ $ this ->fail ('Following file contains ' . $ count . ' blocks without name. ' .
30
+ 'File Path: ' . "\n" . $ layoutFile );
31
+ }
32
+ },
33
+ \Magento \Framework \App \Utility \Files::init ()->getLayoutFiles ()
34
+ );
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments