File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 4444 - name : Install dependencies with composer
4545 run : composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
4646
47- # - name: Setup project
48- # run: |
49- # mv config/autoload/local.test.php.dist config/autoload/local.test.php
50-
5147 - name : Collect code coverage with PHPUnit
5248 run : vendor/bin/phpunit --colors=always --coverage-clover clover.xml
5349
Original file line number Diff line number Diff line change @@ -26,7 +26,19 @@ function copyFile(array $file): void
2626
2727function getEnvironment (): string
2828{
29- return file_exists ('config/development.config.php ' ) ? ENVIRONMENT_DEVELOPMENT : ENVIRONMENT_PRODUCTION ;
29+ $ composerInstalledJson = 'vendor/composer/installed.json ' ;
30+ if (! file_exists ($ composerInstalledJson )) {
31+ throw new RuntimeException ('Composer installed JSON file not found. ' );
32+ }
33+
34+ $ data = json_decode (file_get_contents ($ composerInstalledJson ), true );
35+ foreach ($ data as $ package ) {
36+ if (! empty ($ package ['dev ' ])) {
37+ return ENVIRONMENT_DEVELOPMENT ;
38+ }
39+ }
40+
41+ return ENVIRONMENT_PRODUCTION ;
3042}
3143
3244// when adding files to the below array the `source` and `destination` paths must be relative to the project root folder
@@ -49,6 +61,6 @@ function getEnvironment(): string
4961 ],
5062];
5163
52- echo "Using environment setting : " . getEnvironment () . PHP_EOL ;
64+ echo "Using environment setting: " . getEnvironment () . PHP_EOL ;
5365
5466array_walk ($ files , 'copyFile ' );
You can’t perform that action at this time.
0 commit comments