Skip to content

Instantly share code, notes, and snippets.

@Maras0830
Created April 20, 2017 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maras0830/157878e24dff3088d4bee56d1c5c57fa to your computer and use it in GitHub Desktop.
Save Maras0830/157878e24dff3088d4bee56d1c5c57fa to your computer and use it in GitHub Desktop.
Laravel tests/TestCase.php
<?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