@@ -57,7 +57,6 @@ public function testGetModulePathsAlreadySet()
57
57
*/
58
58
public function testGetModulePathsAggregate ()
59
59
{
60
-
61
60
$ this ->mockForceGenerate (false );
62
61
$ this ->setMockResolverClass (
63
62
false ,
@@ -89,6 +88,50 @@ public function testGetModulePathsAggregate()
89
88
);
90
89
}
91
90
91
+ /**
92
+ * Validate aggregateTestModulePaths() when module path part of DEV_TESTS
93
+ *
94
+ * @throws \Exception
95
+ */
96
+ public function testAggregateTestModulePathsDevTests ()
97
+ {
98
+ $ origin = TESTS_MODULE_PATH ;
99
+ $ modulePath = ModuleResolver::DEV_TESTS . DIRECTORY_SEPARATOR . "Magento " ;
100
+ putenv ("TESTS_MODULE_PATH= $ modulePath " );
101
+
102
+ $ this ->mockForceGenerate (false );
103
+ $ mockResolver = $ this ->setMockResolverClass (
104
+ true ,
105
+ [],
106
+ null ,
107
+ null ,
108
+ [],
109
+ [],
110
+ [],
111
+ null ,
112
+ null ,
113
+ [],
114
+ [],
115
+ null ,
116
+ function ($ arg ) {
117
+ return $ arg ;
118
+ },
119
+ function ($ arg ) {
120
+ return $ arg ;
121
+ }
122
+ );
123
+ $ resolver = ModuleResolver::getInstance ();
124
+ $ this ->setMockResolverProperties ($ resolver , null , null );
125
+ $ this ->assertEquals (
126
+ [],
127
+ $ resolver ->getModulesPath ()
128
+ );
129
+
130
+ $ mockResolver ->verifyNeverInvoked ('globRelevantPaths ' , [$ modulePath , '' ]);
131
+
132
+ putenv ("TESTS_MODULE_PATH= $ origin " );
133
+ }
134
+
92
135
/**
93
136
* Validate correct path locations are fed into globRelevantPaths
94
137
* @throws \Exception
@@ -409,6 +452,81 @@ public function testMergeFlipAndFilterModulePathsNoForceGenerate()
409
452
);
410
453
}
411
454
455
+ /**
456
+ * Validate mergeModulePaths() and flipAndSortModulePathsArray()
457
+ *
458
+ * @throws \Exception
459
+ */
460
+ public function testMergeFlipNoSortModulePathsNoForceGenerate ()
461
+ {
462
+ $ this ->mockForceGenerate (false );
463
+ $ this ->setMockResolverClass (
464
+ false ,
465
+ null ,
466
+ null ,
467
+ null ,
468
+ null ,
469
+ null ,
470
+ null ,
471
+ null ,
472
+ null ,
473
+ [
474
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR
475
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleA ' =>
476
+ [
477
+ 'Magento_ModuleA '
478
+ ],
479
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR
480
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleBC ' =>
481
+ [
482
+ 'Magento_ModuleB ' ,
483
+ 'Magento_ModuleC ' ,
484
+ ],
485
+ ],
486
+ [
487
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR
488
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleCD ' =>
489
+ [
490
+ 'Magento_ModuleC ' ,
491
+ 'Magento_ModuleD '
492
+ ],
493
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR
494
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleE ' =>
495
+ [
496
+ 'Magento_ModuleE '
497
+ ],
498
+ ],
499
+ [
500
+ 'some ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'example ' => ['Magento_Example ' ],
501
+ 'other ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'sample ' => ['Magento_Sample ' ],
502
+ ]
503
+ );
504
+
505
+ $ resolver = ModuleResolver::getInstance ();
506
+ $ this ->setMockResolverProperties (
507
+ $ resolver ,
508
+ null ,
509
+ [
510
+ 0 => 'Magento_ModuleB ' ,
511
+ 1 => 'Magento_ModuleC ' ,
512
+ 2 => 'Magento_ModuleE ' ,
513
+ 3 => 'Magento_Example ' ,
514
+ 4 => 'Magento_Otherexample '
515
+ ]
516
+ );
517
+
518
+ $ this ->assertEquals (
519
+ [
520
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
521
+ . 'ModuleE ' ,
522
+ 'some ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'example ' ,
523
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
524
+ . 'ModuleBC '
525
+ ],
526
+ $ resolver ->getModulesPath ()
527
+ );
528
+ }
529
+
412
530
/**
413
531
* Validate mergeModulePaths() and flipAndSortModulePathsArray()
414
532
*
@@ -428,23 +546,27 @@ public function testMergeFlipAndSortModulePathsForceGenerate()
428
546
null ,
429
547
null ,
430
548
[
431
- 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'pathA ' =>
549
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR
550
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleA ' =>
432
551
[
433
552
'Magento_ModuleA '
434
553
],
435
- 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'pathB ' =>
554
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR
555
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleBC ' =>
436
556
[
437
557
'Magento_ModuleB ' ,
438
558
'Magento_ModuleC ' ,
439
559
],
440
560
],
441
561
[
442
- 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'pathA ' =>
562
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR
563
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleCD ' =>
443
564
[
444
565
'Magento_ModuleC ' ,
445
566
'Magento_ModuleD '
446
567
],
447
- 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'pathB ' =>
568
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR
569
+ . 'Magento ' . DIRECTORY_SEPARATOR . 'ModuleD ' =>
448
570
[
449
571
'Magento_ModuleD '
450
572
],
@@ -467,14 +589,19 @@ public function testMergeFlipAndSortModulePathsForceGenerate()
467
589
4 => 'Magento_Otherexample '
468
590
]
469
591
);
592
+
470
593
$ this ->assertEquals (
471
594
[
472
595
'some ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'example ' ,
473
- 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'pathA ' ,
474
- 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'pathB ' ,
475
- 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'pathA ' ,
476
- 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'pathB ' ,
477
- 'other ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'sample '
596
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
597
+ . 'ModuleA ' ,
598
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
599
+ . 'ModuleD ' ,
600
+ 'other ' . DIRECTORY_SEPARATOR . 'path ' . DIRECTORY_SEPARATOR . 'sample ' ,
601
+ 'composer ' . DIRECTORY_SEPARATOR . 'json ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
602
+ . 'ModuleBC ' ,
603
+ 'composer ' . DIRECTORY_SEPARATOR . 'install ' . DIRECTORY_SEPARATOR . 'Magento ' . DIRECTORY_SEPARATOR
604
+ . 'ModuleCD '
478
605
],
479
606
$ resolver ->getModulesPath ()
480
607
);
0 commit comments