From 6763da6b2abd10bdeac3c0c645a71c713c89361f Mon Sep 17 00:00:00 2001 From: crynobone Date: Sun, 2 Aug 2015 10:26:15 +0800 Subject: [PATCH] Update readme. Signed-off-by: crynobone --- README.md | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ce4ecb1..db91963 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ To install through composer, simply put the following in your `composer.json` fi ```json { - "require-dev": { - "orchestra/testbench": "~3.0" - } + "require-dev": { + "orchestra/testbench": "~3.0" + } } ``` @@ -48,7 +48,7 @@ And then run `composer install` from the terminal. Above installation can also be simplify by using the following command: - composer require --dev "orchestra/testbench=~3.0" + composer require --dev "orchestra/testbench=~3.0" ## Usage @@ -57,8 +57,10 @@ To use Testbench Component, all you need to do is extend `Orchestra\Testbench\Te ```php 'Acme\Facade' - ]; + return [ + 'Acme' => 'Acme\Facade' + ]; } ``` @@ -95,9 +97,9 @@ Since `Orchestra\Testbench\TestCase` replace Laravel's `Illuminate\Foundation\Te */ public function setUp() { - parent::setUp(); + parent::setUp(); - // Your code here + // Your code here } ``` @@ -112,7 +114,13 @@ If you need to add something early in the application bootstrapping process, you */ protected function getEnvironmentSetUp($app) { - // + // Setup default database to use sqlite :memory: + $app['config']->set('database.default', 'testbench'); + $app['config']->set('database.connections.testbench', [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + ]); } ``` @@ -167,6 +175,17 @@ protected function getApplicationTimezone($app) } ``` +### Using Migrations + +Testbench include a custom migrations command that support `realpath` option instead of the basic relative `path` option, this would make it easier for you to run database migrations during testing by just including the full realpath to your package database/migration folder. + +```php +$this->artisan('migrate', [ + '--database' => 'testbench', + '--realpath' => realpath(__DIR__.'/../migrations'), +]); +``` + ## Example To see a working example of testbench including how to set your configuration, check the file: