@@ -73,14 +73,28 @@ EOPHP
73
73
74
74
}
75
75
76
+ $ components = array ();
76
77
$ cmd = array_map ('escapeshellarg ' , $ argv );
77
78
$ exit = 0 ;
78
79
79
80
if (isset ($ argv [1 ]) && 'symfony ' === $ argv [1 ] && !file_exists ('symfony ' ) && file_exists ('src/Symfony ' )) {
80
81
$ argv [1 ] = 'src/Symfony ' ;
81
82
}
82
83
if (isset ($ argv [1 ]) && is_dir ($ argv [1 ]) && !file_exists ($ argv [1 ].'/phpunit.xml.dist ' )) {
83
- array_shift ($ cmd );
84
+ // Find Symfony components in plain php for Windows portability
85
+
86
+ $ finder = new RecursiveDirectoryIterator ($ argv [1 ], FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS );
87
+ $ finder = new RecursiveIteratorIterator ($ finder );
88
+ $ finder ->setMaxDepth (getenv ('SYMFONY_PHPUNIT_MAX_DEPTH ' ) ?: 3 );
89
+
90
+ foreach ($ finder as $ file => $ fileInfo ) {
91
+ if ('phpunit.xml.dist ' === $ file ) {
92
+ $ components [] = dirname ($ fileInfo ->getPathname ());
93
+ }
94
+ }
95
+ if ($ components ) {
96
+ array_shift ($ cmd );
97
+ }
84
98
}
85
99
86
100
$ cmd [0 ] = sprintf ('%s %s --colors=always ' , $ PHP , escapeshellarg ("$ PHPUNIT_DIR /phpunit- $ PHPUNIT_VERSION /phpunit " ));
@@ -92,34 +106,24 @@ if ('\\' === DIRECTORY_SEPARATOR) {
92
106
$ cmd .= '%2$s ' ;
93
107
}
94
108
95
- if (isset ($ argv [1 ]) && is_dir ($ argv [1 ]) && !file_exists ($ argv [1 ].'/phpunit.xml.dist ' )) {
96
- // Find Symfony components in plain php for Windows portability
97
-
98
- $ finder = new RecursiveDirectoryIterator ($ argv [1 ], FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS );
99
- $ finder = new RecursiveIteratorIterator ($ finder );
100
- $ finder ->setMaxDepth (getenv ('SYMFONY_PHPUNIT_MAX_DEPTH ' ) ?: 3 );
101
-
109
+ if ($ components ) {
102
110
$ skippedTests = isset ($ _SERVER ['SYMFONY_PHPUNIT_SKIPPED_TESTS ' ]) ? $ _SERVER ['SYMFONY_PHPUNIT_SKIPPED_TESTS ' ] : false ;
103
111
$ runningProcs = array ();
104
112
105
- foreach ($ finder as $ file => $ fileInfo ) {
106
- if ('phpunit.xml.dist ' === $ file ) {
107
- $ component = dirname ($ fileInfo ->getPathname ());
113
+ foreach ($ components as $ component ) {
114
+ // Run phpunit tests in parallel
108
115
109
- // Run phpunit tests in parallel
110
-
111
- if ($ skippedTests ) {
112
- putenv ("SYMFONY_PHPUNIT_SKIPPED_TESTS= $ component/ $ skippedTests " );
113
- }
116
+ if ($ skippedTests ) {
117
+ putenv ("SYMFONY_PHPUNIT_SKIPPED_TESTS= $ component/ $ skippedTests " );
118
+ }
114
119
115
- $ c = escapeshellarg ($ component );
120
+ $ c = escapeshellarg ($ component );
116
121
117
- if ($ proc = proc_open (sprintf ($ cmd , $ c , " > $ c/phpunit.stdout 2> $ c/phpunit.stderr " ), array (), $ pipes )) {
118
- $ runningProcs [$ component ] = $ proc ;
119
- } else {
120
- $ exit = 1 ;
121
- echo "\033[41mKO \033[0m $ component \n\n" ;
122
- }
122
+ if ($ proc = proc_open (sprintf ($ cmd , $ c , " > $ c/phpunit.stdout 2> $ c/phpunit.stderr " ), array (), $ pipes )) {
123
+ $ runningProcs [$ component ] = $ proc ;
124
+ } else {
125
+ $ exit = 1 ;
126
+ echo "\033[41mKO \033[0m $ component \n\n" ;
123
127
}
124
128
}
125
129
0 commit comments