Last active
September 30, 2016 10:00
-
-
Save joshuamabina/0ddaf73b7e04d538bbb2876a5edcd68c to your computer and use it in GitHub Desktop.
Awesome TestCase
This file contains 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 | |
class TestCase extends Illuminate\Foundation\Testing\TestCase | |
{ | |
/** | |
* The base URL to use while testing the application. | |
* | |
* @var string | |
*/ | |
protected $baseUrl = 'http://localhost'; | |
protected $app; | |
/** | |
* Creates the application. | |
* | |
* @return \Illuminate\Foundation\Application | |
*/ | |
public function createApplication() | |
{ | |
$app = require __DIR__.'/../bootstrap/app.php'; | |
if (file_exists(dirname(__DIR__) . '/.env.test')) { | |
(new \Dotenv\Dotenv(dirname(__DIR__), '.env.test'))->load(); | |
$this->baseUrl = env('APP_URL'); | |
} | |
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); | |
return $app; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment