Skip to content

Commit

Permalink
DB config load changes
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Sep 29, 2020
1 parent b07b09a commit 4ed258b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ jobs:
TERM: xterm-256color

- name: Run Coveralls
if: ${{ success() }}
run: |
composer global require twinh/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }}
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}

coveralls-finish:
needs: [tests]
Expand Down
15 changes: 0 additions & 15 deletions app/Config/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,6 @@ public function __construct()
if (ENVIRONMENT === 'testing')
{
$this->defaultGroup = 'tests';

// Under Github Actions, we can set an ENV var named 'DB'
// so that we can test against multiple databases.
if ($group = getenv('DB'))
{
if (is_file(TESTPATH . '_github/Database.php'))
{
require TESTPATH . '_github/Database.php';

if (! empty($dbconfig) && array_key_exists($group, $dbconfig))
{
$this->tests = $dbconfig[$group];
}
}
}
}
}

Expand Down
34 changes: 34 additions & 0 deletions tests/_support/Config/Registrar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php namespace Tests\Support\Config;

/**
* Class Registrar
*
* Provides a basic registrar class for testing BaseConfig registration functions.
*/

class Registrar
{

public static function Database()
{
$config = [];

// Under Github Actions, we can set an ENV var named 'DB'
// so that we can test against multiple databases.
if ($group = getenv('DB'))
{
if (is_file(TESTPATH . '_github/Database.php'))
{
require TESTPATH . '_github/Database.php';

if (! empty($dbconfig) && array_key_exists($group, $dbconfig))
{
$config['tests'] = $dbconfig[$group];
}
}
}

return $config;
}

}

0 comments on commit 4ed258b

Please sign in to comment.