|
16 | 16 | use Magento\TestFramework\Dependency\LayoutRule; |
17 | 17 | use Magento\TestFramework\Dependency\PhpRule; |
18 | 18 | use Magento\TestFramework\Dependency\ReportsConfigRule; |
| 19 | +use Magento\TestFramework\Dependency\AnalyticsConfigRule; |
19 | 20 | use Magento\TestFramework\Dependency\VirtualType\VirtualTypeMapper; |
20 | 21 |
|
21 | 22 | /** |
@@ -78,6 +79,17 @@ class DependencyTest extends \PHPUnit\Framework\TestCase |
78 | 79 | */ |
79 | 80 | protected static $_listRoutesXml = []; |
80 | 81 |
|
| 82 | + /** |
| 83 | + * List of analytics.xml |
| 84 | + * |
| 85 | + * Format: array( |
| 86 | + * '{Module_Name}' => '{Filename}' |
| 87 | + * ) |
| 88 | + * |
| 89 | + * @var array |
| 90 | + */ |
| 91 | + protected static $_listAnalyticsXml = []; |
| 92 | + |
81 | 93 | /** |
82 | 94 | * List of routers |
83 | 95 | * |
@@ -176,6 +188,7 @@ public static function setUpBeforeClass() |
176 | 188 | self::_prepareListConfigXml(); |
177 | 189 | self::_prepareListDbSchemaXml(); |
178 | 190 | self::_prepareListRoutesXml(); |
| 191 | + self::_prepareListAnalyticsXml(); |
179 | 192 |
|
180 | 193 | self::_prepareMapRouters(); |
181 | 194 | self::_prepareMapLayoutBlocks(); |
@@ -240,6 +253,7 @@ protected static function _initRules() |
240 | 253 | ), |
241 | 254 | new DiRule(new VirtualTypeMapper()), |
242 | 255 | new ReportsConfigRule($dbRuleTables), |
| 256 | + new AnalyticsConfigRule(), |
243 | 257 | ]; |
244 | 258 | } |
245 | 259 |
|
@@ -571,6 +585,20 @@ protected static function _prepareListRoutesXml() |
571 | 585 | } |
572 | 586 | } |
573 | 587 |
|
| 588 | + /** |
| 589 | + * Prepare list of analytics.xml files |
| 590 | + */ |
| 591 | + protected static function _prepareListAnalyticsXml() |
| 592 | + { |
| 593 | + $files = Files::init()->getDbSchemaFiles('analytics.xml', [], false); |
| 594 | + foreach ($files as $file) { |
| 595 | + if (preg_match('/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) { |
| 596 | + $module = $matches['namespace'] . '\\' . $matches['module']; |
| 597 | + self::$_listAnalyticsXml[$module] = $file; |
| 598 | + } |
| 599 | + } |
| 600 | + } |
| 601 | + |
574 | 602 | /** |
575 | 603 | * Prepare map of routers |
576 | 604 | */ |
|
0 commit comments