11
11
use Magento \TestFramework \Workaround \Override \Config ;
12
12
use Magento \TestFramework \Workaround \Override \WrapperGenerator ;
13
13
use PHPUnit \Framework \TestSuite ;
14
- use PHPUnit \Util \Configuration ;
14
+ use PHPUnit \TextUI \Configuration \Registry ;
15
+ use PHPUnit \TextUI \Configuration \TestSuiteCollection ;
16
+ use PHPUnit \TextUI \Configuration \TestSuiteMapper ;
15
17
16
18
/**
17
19
* Integration tests wrapper.
@@ -27,24 +29,28 @@ public static function suite($className)
27
29
{
28
30
$ generator = new WrapperGenerator ();
29
31
$ overrideConfig = Config::getInstance ();
30
- $ configuration = Configuration ::getInstance (self ::getConfigurationFile ());
31
- $ suites = $ configuration ->getTestSuiteConfiguration ();
32
+ $ configuration = Registry ::getInstance ()-> get (self ::getConfigurationFile ());
33
+ $ suitesConfig = $ configuration ->testSuite ();
32
34
$ suite = new TestSuite ();
33
- /** @var TestSuite $testSuite */
34
- foreach ($ suites as $ testSuite ) {
35
- if ($ testSuite -> getName () === 'Magento Integration Tests ' ) {
35
+ /** @var \PHPUnit\TextUI\Configuration\ TestSuite $suiteConfig */
36
+ foreach ($ suitesConfig as $ suiteConfig ) {
37
+ if ($ suiteConfig -> name () === 'Magento Integration Tests ' ) {
36
38
continue ;
37
39
}
38
- /** @var TestSuite $test */
39
- foreach ($ testSuite as $ test ) {
40
- $ testName = $ test ->getName ();
40
+ $ suites = (new TestSuiteMapper ())->map (TestSuiteCollection::fromArray ([$ suiteConfig ]), '' );
41
+ /** @var TestSuite $testSuite */
42
+ foreach ($ suites as $ testSuite ) {
43
+ /** @var TestSuite $test */
44
+ foreach ($ testSuite as $ test ) {
45
+ $ testName = $ test ->getName ();
41
46
42
- if ($ overrideConfig ->hasConfiguration ($ testName ) && !$ test instanceof SkippableInterface) {
43
- $ reflectionClass = new \ReflectionClass ($ testName );
44
- $ resultTest = $ generator ->generateTestWrapper ($ reflectionClass );
45
- $ suite ->addTest (new TestSuite ($ resultTest , $ testName ));
46
- } else {
47
- $ suite ->addTest ($ test );
47
+ if ($ overrideConfig ->hasConfiguration ($ testName ) && !$ test instanceof SkippableInterface) {
48
+ $ reflectionClass = new \ReflectionClass ($ testName );
49
+ $ resultTest = $ generator ->generateTestWrapper ($ reflectionClass );
50
+ $ suite ->addTest (new TestSuite ($ resultTest , $ testName ));
51
+ } else {
52
+ $ suite ->addTest ($ test );
53
+ }
48
54
}
49
55
}
50
56
}
0 commit comments