Skip to content

Commit

Permalink
Update readme.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Aug 2, 2015
1 parent 5960c57 commit 6763da6
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
```

Expand All @@ -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

Expand All @@ -57,8 +57,10 @@ To use Testbench Component, all you need to do is extend `Orchestra\Testbench\Te
```php
<?php

class TestCase extends Orchestra\Testbench\TestCase {}

class TestCase extends Orchestra\Testbench\TestCase
{
//
}
```

### Custom Service Provider
Expand All @@ -68,7 +70,7 @@ To load your package service provider, override the `getPackageProviders`.
```php
protected function getPackageProviders($app)
{
return ['Acme\AcmeServiceProvider'];
return ['Acme\AcmeServiceProvider'];
}
```

Expand All @@ -79,9 +81,9 @@ To load your package alias, override the `getPackageAliases`.
```php
protected function getPackageAliases($app)
{
return [
'Acme' => 'Acme\Facade'
];
return [
'Acme' => 'Acme\Facade'
];
}
```

Expand All @@ -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
}
```

Expand All @@ -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' => '',
]);
}
```

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6763da6

Please sign in to comment.