Prep for unit testing
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
'default' => 'sqlite',
|
||||
|
||||
'connections' => array(
|
||||
'sqlite' => array(
|
||||
'driver' => 'sqlite',
|
||||
'database' => ':memory:',
|
||||
'prefix' => ''
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase {
|
||||
|
||||
/**
|
||||
* Default preparation for each test
|
||||
*
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp(); // Don't forget this!
|
||||
|
||||
$this->prepareForTests();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
@@ -16,4 +28,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase {
|
||||
return require __DIR__.'/../../bootstrap/start.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates the database and set the mailer to 'pretend'.
|
||||
* This will cause the tests to run quickly.
|
||||
*
|
||||
*/
|
||||
private function prepareForTests()
|
||||
{
|
||||
Artisan::call('migrate');
|
||||
Mail::pretend(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user