|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Tests; |
| 4 | + |
| 5 | +use Illuminate\Contracts\Config\Repository; |
| 6 | +use Illuminate\Foundation\Application; |
| 7 | +use Illuminate\Support\Facades\Route; |
| 8 | +use Illuminate\Support\ServiceProvider; |
| 9 | +use Luezoid\Http\Controllers\MinionController; |
| 10 | +use Luezoid\Laravelcore\Http\Controllers\FileController; |
| 11 | + |
| 12 | +require_once __DIR__.'/../Controllers/MinionController.php'; |
| 13 | +require_once __DIR__.'/../Repositories/MinionRepository.php'; |
| 14 | + |
| 15 | +class TestCase extends \Orchestra\Testbench\TestCase |
| 16 | +{ |
| 17 | + /** |
| 18 | + * Get package providers. |
| 19 | + * |
| 20 | + * @param Application $app |
| 21 | + * |
| 22 | + * @return array<int, class-string<ServiceProvider>> |
| 23 | + */ |
| 24 | + protected function getPackageProviders($app): array |
| 25 | + { |
| 26 | + return [ |
| 27 | + 'Luezoid\Laravelcore\CoreServiceProvider', |
| 28 | + ]; |
| 29 | + } |
| 30 | + |
| 31 | + public function defineEnvironment($app) |
| 32 | + { |
| 33 | + tap($app->make('config'), function (Repository $config) { |
| 34 | + $config->set('database.default', 'test'); |
| 35 | + $config->set('database.connections.test', [ |
| 36 | + 'driver' => 'sqlite', |
| 37 | + 'database' => ':memory:', |
| 38 | + 'prefix' => '', |
| 39 | + ]); |
| 40 | + }); |
| 41 | + } |
| 42 | + |
| 43 | + protected function defineRoutes($router) |
| 44 | + { |
| 45 | + Route::resource('api/minions', MinionController::class, ['parameters' => ['minions' => 'id']]); |
| 46 | + Route::post('api/files',[FileController::class, 'store']); |
| 47 | + } |
| 48 | + |
| 49 | + protected function defineDatabaseMigrations() |
| 50 | + { |
| 51 | + $this->loadMigrationsFrom(__DIR__ . '/../migrations'); |
| 52 | + $this->artisan('migrate', ['--database' => 'test'])->run(); |
| 53 | + } |
| 54 | + |
| 55 | + |
| 56 | +} |
0 commit comments