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