diff --git a/app/config/testing/database.php b/app/config/testing/database.php new file mode 100644 index 0000000000..b15c97c575 --- /dev/null +++ b/app/config/testing/database.php @@ -0,0 +1,14 @@ + 'sqlite', + + 'connections' => array( + 'sqlite' => array( + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '' + ), + ) +); \ No newline at end of file diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php index 49b80fc274..c9f4d33996 100755 --- a/app/tests/TestCase.php +++ b/app/tests/TestCase.php @@ -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); + } + }