Skip to content

Commit

Permalink
set getEnvironmentSetUp
Browse files Browse the repository at this point in the history
  • Loading branch information
milwad-dev committed Jun 1, 2024
1 parent 9c6acf7 commit 8fdaac2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Commands/MakeQueryCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Milwad\LaravelCrod\Tests\Commands;

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\File;
use Milwad\LaravelCrod\Tests\TestCase;
use Orchestra\Testbench\Concerns\InteractsWithPublishedFiles;
use PHPUnit\Framework\Attributes\Test;
Expand Down
22 changes: 22 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Milwad\LaravelCrod\Tests;

use Illuminate\Encryption\Encrypter;
use Milwad\LaravelCrod\LaravelCrodServiceProvider;

class TestCase extends \Orchestra\Testbench\TestCase
Expand All @@ -19,4 +20,25 @@ protected function getPackageProviders($app)
LaravelCrodServiceProvider::class,
];
}

/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
*/
protected function getEnvironmentSetUp($app)
{
// Set default database to use sqlite :memory:
$app['config']->set('database.default', 'testing');
$app['config']->set('database.connections.testing', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);

// Set app key
$app['config']->set('app.key', 'base64:'.base64_encode(
Encrypter::generateKey(config()['app.cipher'])
));
}
}

0 comments on commit 8fdaac2

Please sign in to comment.