Created
April 20, 2017 05:06
-
-
Save Maras0830/157878e24dff3088d4bee56d1c5c57fa to your computer and use it in GitHub Desktop.
Laravel tests/TestCase.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Artisan; | |
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase | |
{ | |
/** | |
* The base URL to use while testing the application. | |
* | |
* @var string | |
*/ | |
protected $baseUrl = 'http://api.4gamers.dev'; | |
/** | |
* Creates the application. | |
* | |
* @return \Illuminate\Foundation\Application | |
*/ | |
public function createApplication() | |
{ | |
$app = require __DIR__.'/../bootstrap/app.php'; | |
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); | |
return $app; | |
} | |
public function setUp() | |
{ | |
parent::setUp(); | |
Artisan::call('migrate'); | |
Artisan::call("db:seed"); | |
factory(Gamers\Admin::class, 10)->create(); | |
factory(Gamers\News::class, 10)->create(); | |
} | |
public function tearDown() | |
{ | |
Artisan::call('migrate:rollback'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment