@@ -1988,16 +1988,16 @@ public function provideGetInstallerVersionFromComposer(): array
19881988 // the `6.0` branches are created - currently only `6` branches exist
19891989 ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/framework ' => '6.x-dev ' ], 'silverstripe-module ' , '6.x-dev ' ],
19901990 ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/framework ' => '6.0.x-dev ' ], 'silverstripe-vendormodule ' , '6.0.x-dev ' ],
1991- ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/framework ' => '^6 ' ], 'silverstripe-theme ' , '6.x-dev ' ],
1992- ['myaccount/silverstripe-somemodule ' , 'mybranch ' , ['silverstripe/cms ' => '^6 ' ], 'silverstripe-recipe ' , '6.x-dev ' ],
1993- ['myaccount/silverstripe-somemodule ' , 'mybranch ' , ['silverstripe/admin ' => '^3 ' ], 'silverstripe-vendormodule ' , '6.x-dev ' ],
1991+ ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/framework ' => '^6 ' ], 'silverstripe-theme ' , '6.0. x-dev ' ],
1992+ ['myaccount/silverstripe-somemodule ' , 'mybranch ' , ['silverstripe/cms ' => '^6 ' ], 'silverstripe-recipe ' , '6.0. x-dev ' ],
1993+ ['myaccount/silverstripe-somemodule ' , 'mybranch ' , ['silverstripe/admin ' => '^3 ' ], 'silverstripe-vendormodule ' , '6.0. x-dev ' ],
19941994 ['myaccount/silverstripe-somemodule ' , '4 ' , ['silverstripe/framework ' => '^6 ' ], 'silverstripe-vendormodule ' , '6.x-dev ' ],
19951995 ['myaccount/silverstripe-somemodule ' , '4 ' , ['silverstripe/framework ' => '^6 ' ], 'package ' , '' ],
19961996 ['myaccount/silverstripe-somemodule ' , '4 ' , ['silverstripe/framework ' => '^6 ' ], '' , '' ],
19971997 ['myaccount/silverstripe-somemodule ' , '4 ' , [], '' , '' ],
19981998 // // recipe-plugin and vendor-plugin do not override framework
1999- ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/recipe-plugin ' => '^2 ' , 'silverstripe/framework ' => '^6 ' ], 'silverstripe-vendormodule ' , '6.x-dev ' ],
2000- ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/vendor-plugin ' => '^2 ' , 'silverstripe/framework ' => '^6 ' ], 'silverstripe-vendormodule ' , '6.x-dev ' ],
1999+ ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/recipe-plugin ' => '^2 ' , 'silverstripe/framework ' => '^6 ' ], 'silverstripe-vendormodule ' , '6.0. x-dev ' ],
2000+ ['myaccount/silverstripe-admin ' , 'mybranch ' , ['silverstripe/vendor-plugin ' => '^2 ' , 'silverstripe/framework ' => '^6 ' ], 'silverstripe-vendormodule ' , '6.0. x-dev ' ],
20012001 ];
20022002 }
20032003
@@ -2299,4 +2299,80 @@ public function testDuplicateJobsRemoved(): void
22992299 ];
23002300 $ this ->assertSame ($ expected , $ actual );
23012301 }
2302+
2303+ public function providePhpFallbackDoorman (): array
2304+ {
2305+ return [
2306+ 'php81 ' => [
2307+ 'php ' => '^8.1 ' ,
2308+ 'exception ' => false ,
2309+ 'expected ' => [
2310+ '8.1 prf-low mariadb phpunit all ' ,
2311+ '8.2 mysql80 phpunit all ' ,
2312+ '8.3 mysql84 phpunit all ' ,
2313+ ],
2314+ ],
2315+ 'php83 ' => [
2316+ 'php ' => '^8.3 ' ,
2317+ 'exception ' => false ,
2318+ 'expected ' => [
2319+ '8.3 prf-low mariadb phpunit all ' ,
2320+ '8.3 mysql80 phpunit all ' ,
2321+ '8.4 mysql84 phpunit all ' ,
2322+ ],
2323+ ],
2324+ 'none ' => [
2325+ 'php ' => 'none ' ,
2326+ 'exception ' => true ,
2327+ 'expected ' => null ,
2328+ ],
2329+ ];
2330+ }
2331+
2332+ /**
2333+ * @dataProvider providePhpFallbackDoorman
2334+ */
2335+ public function testPhpFallbackDoorman (string $ php , bool $ exception , ?array $ expected ): void
2336+ {
2337+ if (!function_exists ('yaml_parse ' )) {
2338+ $ this ->markTestSkipped ('yaml extension is not installed ' );
2339+ }
2340+ if ($ exception ) {
2341+ $ this ->expectException (Exception::class);
2342+ }
2343+ try {
2344+ $ yml = implode ("\n" , [
2345+ <<<EOT
2346+ composer_install: false
2347+ endtoend: true
2348+ js: true
2349+ phpcoverage: false
2350+ phpcoverage_force_off: false
2351+ phplinting: true
2352+ phpunit: true
2353+ doclinting: true
2354+ phpunit_skip_suites: ''
2355+ dynamic_matrix: true
2356+ simple_matrix: false
2357+ github_repository: 'silverstripe/doorman'
2358+ github_my_ref: '5'
2359+ parent_branch: ''
2360+ EOT
2361+ ]);
2362+ $ creator = new JobCreator ();
2363+ $ creator ->composerJsonPath = '__composer.json ' ;
2364+ $ this ->writeComposerJson (['php ' => $ php ]);
2365+ $ creator ->githubRepository = 'silverstripe/doorman ' ;
2366+ $ creator ->repoName = 'doorman ' ;
2367+ $ creator ->branch = '5 ' ;
2368+ $ creator ->parseRepositoryMetadata ();
2369+ $ json = json_decode ($ creator ->createJson ($ yml ));
2370+ $ actual = array_map (fn ($ job ) => $ job ->name , $ json ->include );
2371+ $ this ->assertSame ($ expected , $ actual );
2372+ } finally {
2373+ if (file_exists ('__composer.json ' )) {
2374+ unlink ('__composer.json ' );
2375+ }
2376+ }
2377+ }
23022378}
0 commit comments