Skip to content

Instantly share code, notes, and snippets.

@joshuamabina
Last active September 30, 2016 10:00
Show Gist options
  • Save joshuamabina/0ddaf73b7e04d538bbb2876a5edcd68c to your computer and use it in GitHub Desktop.
Save joshuamabina/0ddaf73b7e04d538bbb2876a5edcd68c to your computer and use it in GitHub Desktop.
Awesome TestCase
<?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