ObsoleteAclTest.php 936 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 acl declaration
  8. */
  9. namespace Magento\Test\Legacy;
  10. class ObsoleteAclTest extends \PHPUnit\Framework\TestCase
  11. {
  12. public function testAclDeclarations()
  13. {
  14. $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
  15. $invoker(
  16. /**
  17. * @param string $aclFile
  18. */
  19. function ($aclFile) {
  20. $aclXml = simplexml_load_file($aclFile);
  21. $xpath = '/config/acl/*[boolean(./children) or boolean(./title)]';
  22. $this->assertEmpty(
  23. $aclXml->xpath($xpath),
  24. 'Obsolete acl structure detected in file ' . $aclFile . '.'
  25. );
  26. },
  27. \Magento\Framework\App\Utility\Files::init()->getMainConfigFiles()
  28. );
  29. }
  30. }