ConfigTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Tests for obsolete and removed config nodes
  8. */
  9. namespace Magento\Test\Legacy;
  10. class ConfigTest extends \PHPUnit\Framework\TestCase
  11. {
  12. public function testConfigFiles()
  13. {
  14. $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
  15. $invoker(
  16. /**
  17. * @param string $file
  18. */
  19. function ($file) {
  20. $obsoleteNodes = [];
  21. $obsoleteNodesFiles = glob(__DIR__ . '/_files/obsolete_config_nodes*.php');
  22. foreach ($obsoleteNodesFiles as $obsoleteNodesFile) {
  23. $obsoleteNodes = array_merge($obsoleteNodes, include $obsoleteNodesFile);
  24. }
  25. $xml = simplexml_load_file($file);
  26. foreach ($obsoleteNodes as $xpath => $suggestion) {
  27. $this->assertEmpty(
  28. $xml->xpath($xpath),
  29. "Nodes identified by XPath '{$xpath}' are obsolete. {$suggestion}"
  30. );
  31. }
  32. },
  33. \Magento\Framework\App\Utility\Files::init()->getMainConfigFiles()
  34. );
  35. }
  36. }