Skip to content

Commit

Permalink
Need to prepare .env for Laravel 11 test
Browse files Browse the repository at this point in the history
  • Loading branch information
askdkc committed Jan 17, 2024
1 parent 0f21144 commit 0bd3145
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ protected function setUp(): void
{
parent::setUp();

copy(__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env.example', __DIR__.'/../vendor/orchestra/testbench-core/laravel/.env');

// テスト用のファイルが残ってたら消す(web.php)
if (is_file(__DIR__.'/../vendor/orchestra/testbench-core/laravel/routes/web.php')) {
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/routes/web.php');
Expand Down Expand Up @@ -56,6 +58,17 @@ protected function setUp(): void
file_put_contents(__DIR__.'/../vendor/orchestra/testbench-core/laravel/config/app.php', $configfile);
}

protected function tearDown(): void
{
parent::tearDown();

// テスト用のファイルが残ってたら消す(.env)
if (is_file(__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env')) {
unlink(__DIR__.'/../vendor/orchestra/testbench-core/laravel/.env');
}

}

protected function getPackageProviders($app)
{
return [
Expand Down

0 comments on commit 0bd3145

Please sign in to comment.