ObsoleteMenuTest.php 967 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Legacy tests to find obsolete menu declaration
  8. */
  9. namespace Magento\Test\Legacy;
  10. class ObsoleteMenuTest extends \PHPUnit\Framework\TestCase
  11. {
  12. public function testMenuDeclaration()
  13. {
  14. $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
  15. $invoker(
  16. /**
  17. * @param string $menuFile
  18. */
  19. function ($menuFile) {
  20. $menuXml = simplexml_load_file($menuFile);
  21. $xpath = '/config/menu/*[boolean(./children) or boolean(./title) or boolean(./action)]';
  22. $this->assertEmpty(
  23. $menuXml->xpath($xpath),
  24. 'Obsolete menu structure detected in file ' . $menuFile . '.'
  25. );
  26. },
  27. \Magento\Framework\App\Utility\Files::init()->getMainConfigFiles()
  28. );
  29. }
  30. }