File tree 5 files changed +83
-8
lines changed
5 files changed +83
-8
lines changed Original file line number Diff line number Diff line change @@ -518,16 +518,36 @@ private function relativizeConfigPath(Container $container): void
518
518
return ;
519
519
}
520
520
521
- $ container -> setParameter ( self :: PARAM_PATH , array_map (function (string $ path ) use ($ container ) {
521
+ $ normalizedPaths = array_map (static function (string $ path ) use ($ container ) {
522
522
if (Path::isAbsolute ($ path )) {
523
- return $ path ;
523
+ return [ $ path] ;
524
524
}
525
525
526
- return Path::join ([
527
- dirname ($ container ->getParameter (CoreExtension::PARAM_CONFIG_PATH )),
528
- $ path
529
- ]);
530
- }, $ paths ));
526
+ if (str_contains ($ path , '* ' ) || str_contains ($ path , '? ' )) {
527
+ $ globPaths = glob ($ path , GLOB_NOSORT );
528
+
529
+ if (empty ($ globPaths )) {
530
+ return [];
531
+ }
532
+
533
+ return array_map (static function (string $ path ) use ($ container ) {
534
+ return Path::join ([
535
+ dirname ($ container ->getParameter (CoreExtension::PARAM_CONFIG_PATH )),
536
+ $ path
537
+ ]);
538
+ }, $ globPaths );
539
+ }
540
+
541
+ return [
542
+ Path::join ([
543
+ dirname ($ container ->getParameter (CoreExtension::PARAM_CONFIG_PATH )),
544
+ $ path
545
+ ])
546
+ ];
547
+ }, $ paths );
548
+ $ flattenedPaths = array_merge (...$ normalizedPaths );
549
+
550
+ $ container ->setParameter (self ::PARAM_PATH , $ flattenedPaths );
531
551
}
532
552
533
553
private function registerExecutors (Container $ container ): void
Original file line number Diff line number Diff line change 17
17
class RunTest extends SystemTestCase
18
18
{
19
19
/**
20
- * It should use a speified , valid, configuration.
20
+ * It should use a specified , valid, configuration.
21
21
*/
22
22
public function testSpecifiedConfig (): void
23
23
{
@@ -78,6 +78,17 @@ public function testCommandWithNoPath(): void
78
78
$ this ->assertStringContainsString ('You must either specify ' , $ process ->getErrorOutput ());
79
79
}
80
80
81
+ /**
82
+ * It should resolve glob paths to match multiple files.
83
+ */
84
+ public function testCommandWithGlobPath (): void
85
+ {
86
+ $ process = $ this ->phpbench ('run benchmarks/set7/*/ ' );
87
+ $ this ->assertExitCode (0 , $ process );
88
+ $ this ->assertStringContainsString ('benchNothing2 ' , $ process ->getErrorOutput ());
89
+ $ this ->assertStringContainsString ('benchNothing3 ' , $ process ->getErrorOutput ());
90
+ }
91
+
81
92
public function testCommandWithMultiplePaths (): void
82
93
{
83
94
$ process = $ this ->phpbench ('run benchmarks/set4/NothingBench.php benchmarks/set1/BenchmarkBench.php ' );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the PHPBench package
5
+ *
6
+ * (c) Daniel Leech <daniel@dantleech.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ */
12
+
13
+ namespace PhpBench \Tests \System \benchmarks \set7 \nested1 ;
14
+
15
+ class Nothing2Bench
16
+ {
17
+ public function benchNothing2 (): void
18
+ {
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the PHPBench package
5
+ *
6
+ * (c) Daniel Leech <daniel@dantleech.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ */
12
+
13
+ namespace PhpBench \Tests \System \benchmarks \set7 \nested2 ;
14
+
15
+ class Nothing3Bench
16
+ {
17
+ public function benchNothing3 (): void
18
+ {
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "runner.bootstrap" : " ../../bootstrap/foobar.bootstrap" ,
3
+ "runner.path" : " ../../benchmarks/set7/*/"
4
+ }
You can’t perform that action at this time.
0 commit comments