9
9
namespace Magento \Test \Integrity ;
10
10
11
11
use Magento \Framework \Component \ComponentRegistrar ;
12
+ use Magento \Framework \App \Utility \Files ;
12
13
13
14
/**
14
15
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
@@ -135,7 +136,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase
135
136
*/
136
137
public static function setUpBeforeClass ()
137
138
{
138
- self ::$ _namespaces = implode ('| ' , \ Magento \ Framework \ App \ Utility \ Files::init ()->getNamespaces ());
139
+ self ::$ _namespaces = implode ('| ' , Files::init ()->getNamespaces ());
139
140
140
141
self ::_prepareListConfigXml ();
141
142
self ::_prepareListRoutesXml ();
@@ -385,7 +386,7 @@ public function testRedundant()
385
386
*/
386
387
protected static function _getRelativeFilename ($ absoluteFilename )
387
388
{
388
- $ pathToSource = \ Magento \ Framework \ App \ Utility \ Files::init ()->getPathToSource ();
389
+ $ pathToSource = Files::init ()->getPathToSource ();
389
390
$ relativeFileName = str_replace ($ pathToSource , '' , $ absoluteFilename );
390
391
return trim (str_replace ('\\' , '/ ' , $ relativeFileName ), '/ ' );
391
392
}
@@ -425,27 +426,30 @@ public function getAllFiles()
425
426
$ files ,
426
427
$ this ->_prepareFiles (
427
428
'php ' ,
428
- \Magento \Framework \App \Utility \Files::init ()->getPhpFiles (true , false , false , true , false ),
429
+ Files::init ()->getClassFiles (
430
+ Files::INCLUDE_APP_CODE
431
+ | Files::INCLUDE_DATA_SET
432
+ ),
429
433
true
430
434
)
431
435
);
432
436
433
437
// Get all configuration files
434
438
$ files = array_merge (
435
439
$ files ,
436
- $ this ->_prepareFiles ('config ' , \ Magento \ Framework \ App \ Utility \ Files::init ()->getConfigFiles ())
440
+ $ this ->_prepareFiles ('config ' , Files::init ()->getConfigFiles ())
437
441
);
438
442
439
443
//Get all layout updates files
440
444
$ files = array_merge (
441
445
$ files ,
442
- $ this ->_prepareFiles ('layout ' , \ Magento \ Framework \ App \ Utility \ Files::init ()->getLayoutFiles ())
446
+ $ this ->_prepareFiles ('layout ' , Files::init ()->getLayoutFiles ())
443
447
);
444
448
445
449
// Get all template files
446
450
$ files = array_merge (
447
451
$ files ,
448
- $ this ->_prepareFiles ('template ' , \ Magento \ Framework \ App \ Utility \ Files::init ()->getPhtmlFiles ())
452
+ $ this ->_prepareFiles ('template ' , Files::init ()->getPhtmlFiles ())
449
453
);
450
454
451
455
return $ files ;
@@ -456,7 +460,7 @@ public function getAllFiles()
456
460
*/
457
461
protected static function _prepareListConfigXml ()
458
462
{
459
- $ files = \ Magento \ Framework \ App \ Utility \ Files::init ()->getConfigFiles ('config.xml ' , [], false );
463
+ $ files = Files::init ()->getConfigFiles ('config.xml ' , [], false );
460
464
foreach ($ files as $ file ) {
461
465
if (preg_match ('/(?<namespace>[A-Z][a-z]+)[_\/ \\\\](?<module>[A-Z][a-zA-Z]+)/ ' , $ file , $ matches )) {
462
466
$ module = $ matches ['namespace ' ] . '\\' . $ matches ['module ' ];
@@ -470,7 +474,7 @@ protected static function _prepareListConfigXml()
470
474
*/
471
475
protected static function _prepareListRoutesXml ()
472
476
{
473
- $ files = \ Magento \ Framework \ App \ Utility \ Files::init ()->getConfigFiles ('*/routes.xml ' , [], false );
477
+ $ files = Files::init ()->getConfigFiles ('*/routes.xml ' , [], false );
474
478
foreach ($ files as $ file ) {
475
479
if (preg_match ('/(?<namespace>[A-Z][a-z]+)[_\/ \\\\](?<module>[A-Z][a-zA-Z]+)/ ' , $ file , $ matches )) {
476
480
$ module = $ matches ['namespace ' ] . '\\' . $ matches ['module ' ];
@@ -487,7 +491,7 @@ protected static function _prepareMapRouters()
487
491
$ pattern = '/(?<namespace>[A-Z][a-z]+)[_\/ \\\\](?<module>[A-Z][a-zA-Z]+)\/Controller\/ ' .
488
492
'(?<path>[\/\w]*).php/ ' ;
489
493
490
- $ files = \ Magento \ Framework \ App \ Utility \ Files::init ()->getPhpFiles ( true , false , false , false , false );
494
+ $ files = Files::init ()->getClassFiles (Files:: INCLUDE_APP_CODE );
491
495
foreach ($ files as $ file ) {
492
496
if (preg_match ($ pattern , $ file , $ matches )) {
493
497
$ module = $ matches ['namespace ' ] . '\\' . $ matches ['module ' ];
@@ -533,7 +537,7 @@ private static function updateRoutersMap($module, $configFile)
533
537
*/
534
538
protected static function _prepareMapLayoutBlocks ()
535
539
{
536
- $ files = \ Magento \ Framework \ App \ Utility \ Files::init ()->getLayoutFiles ([], false );
540
+ $ files = Files::init ()->getLayoutFiles ([], false );
537
541
foreach ($ files as $ file ) {
538
542
$ area = 'default ' ;
539
543
if (preg_match ('/[\/](?<area>adminhtml|frontend)[\/]/ ' , $ file , $ matches )) {
@@ -561,7 +565,7 @@ protected static function _prepareMapLayoutBlocks()
561
565
*/
562
566
protected static function _prepareMapLayoutHandles ()
563
567
{
564
- $ files = \ Magento \ Framework \ App \ Utility \ Files::init ()->getLayoutFiles ([], false );
568
+ $ files = Files::init ()->getLayoutFiles ([], false );
565
569
foreach ($ files as $ file ) {
566
570
$ area = 'default ' ;
567
571
if (preg_match ('/\/(?<area>adminhtml|frontend)\// ' , $ file , $ matches )) {
@@ -626,7 +630,7 @@ protected static function convertModuleName($jsonName)
626
630
*/
627
631
protected static function _initDependencies ()
628
632
{
629
- $ jsonFiles = \ Magento \ Framework \ App \ Utility \ Files::init ()->getComposerFiles (ComponentRegistrar::MODULE , false );
633
+ $ jsonFiles = Files::init ()->getComposerFiles (ComponentRegistrar::MODULE , false );
630
634
foreach ($ jsonFiles as $ file ) {
631
635
$ contents = file_get_contents ($ file );
632
636
$ decodedJson = json_decode ($ contents );
0 commit comments