diff --git a/.env.ci b/.env.ci index e99f46691..8d0848734 100644 --- a/.env.ci +++ b/.env.ci @@ -5,10 +5,10 @@ APP_THEME=pterodactyl APP_TIMEZONE=America/Los_Angeles APP_URL=http://localhost/ -TESTING_DB_HOST=127.0.0.1 -TESTING_DB_DATABASE=panel_test -TESTING_DB_USERNAME=root -TESTING_DB_PASSWORD= +DB_HOST=127.0.0.1 +DB_DATABASE=panel_test +DB_USERNAME=root +DB_PASSWORD= CACHE_DRIVER=array SESSION_DRIVER=array diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a59f99a47..e72212b11 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ 7.4, 8.0 ] + php: [ 7.4, 8.0, 8.1 ] database: [ 'mariadb:10.2', 'mysql:8' ] services: database: @@ -50,10 +50,9 @@ jobs: run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit if: ${{ always() }} env: - DB_CONNECTION: testing - TESTING_DB_HOST: UNIT_NO_DB + DB_HOST: UNIT_NO_DB - name: execute integration tests run: vendor/bin/phpunit tests/Integration env: - TESTING_DB_PORT: ${{ job.services.database.ports[3306] }} - TESTING_DB_USERNAME: root + DB_PORT: ${{ job.services.database.ports[3306] }} + DB_USERNAME: root diff --git a/bootstrap/tests.php b/bootstrap/tests.php index 3503d2ac1..35479a0cd 100644 --- a/bootstrap/tests.php +++ b/bootstrap/tests.php @@ -22,9 +22,10 @@ $kernel->bootstrap(); $output = new ConsoleOutput(); -if (config('database.default') !== 'testing') { +$prefix = 'database.connections.' . config('database.default'); +if (config("$prefix.database") !== 'panel_test') { $output->writeln(PHP_EOL . 'Cannot run test process against non-testing database.'); - $output->writeln(PHP_EOL . 'Environment is currently pointed at: "' . config('database.default') . '".'); + $output->writeln(PHP_EOL . 'Environment is currently pointed at: "' . config("$prefix.database") . '".'); exit(1); } @@ -34,10 +35,10 @@ if (config('database.default') !== 'testing') { */ if (!env('SKIP_MIGRATIONS')) { $output->writeln(PHP_EOL . 'Refreshing database for Integration tests...'); - $kernel->call('migrate:fresh', ['--database' => 'testing']); + $kernel->call('migrate:fresh'); $output->writeln('Seeding database for Integration tests...' . PHP_EOL); - $kernel->call('db:seed', ['--database' => 'testing']); + $kernel->call('db:seed'); } else { $output->writeln(PHP_EOL . 'Skipping database migrations...' . PHP_EOL); } diff --git a/config/database.php b/config/database.php index a4b01139c..27bc6deb2 100644 --- a/config/database.php +++ b/config/database.php @@ -57,29 +57,6 @@ return [ PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true), ]) : [], ], - - /* - | ------------------------------------------------------------------------- - | Test Database Connection - | ------------------------------------------------------------------------- - | - | This connection is used by the integration and HTTP tests for Pterodactyl - | development. Normal users of the Panel do not need to adjust any settings - | in here. - */ - 'testing' => [ - 'driver' => 'mysql', - 'host' => env('TESTING_DB_HOST', '127.0.0.1'), - 'port' => env('TESTING_DB_PORT', '3306'), - 'database' => env('TESTING_DB_DATABASE', 'panel_test'), - 'username' => env('TESTING_DB_USERNAME', 'pterodactyl_test'), - 'password' => env('TESTING_DB_PASSWORD', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'strict' => false, - 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), - ], ], /* diff --git a/phpunit.xml b/phpunit.xml index 227dadb9e..b3210d5da 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,17 +1,9 @@ - @@ -19,20 +11,18 @@ - - ./tests/Browser/Processes - - ./tests/Integration + ./tests/Integration - ./tests/Unit + ./tests/Unit - + +