Skip to content

Commit

Permalink
Merge 1508e30 into c3626b4
Browse files Browse the repository at this point in the history
  • Loading branch information
morphatic committed Oct 14, 2013
2 parents c3626b4 + 1508e30 commit 9435910
Showing 1 changed file with 63 additions and 3 deletions.
66 changes: 63 additions & 3 deletions tests/DatabaseFixtureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,38 @@ class DatabaseFixtureTest extends \Orchestra\Testbench\TestCase {
public function setUp()
{
parent::setUp();

// uncomment to enable route filters if your package defines routes with filters
// $this->app['router']->enableFilters();

$this->app['artisan']->call('migrate', array(
'--path' => '../../tests/migrations',
// create an artisan object for calling migrations
$artisan = $this->app->make('artisan');

// call migrations for packages upon which our package depends, e.g. Cartalyst/Sentry
// not necessary if your package doesn't depend on another package that requires
// running migrations for proper installation
/* uncomment as necessary
$artisan->call('migrate', [
'--database' => 'testbench',
));
'--path' => '../vendor/cartalyst/sentry/src/migrations',
]);
*/

// call migrations that will be part of your package, assumes your migrations are in src/migrations
// not neccessary if your package doesn't require any migrations to be run for
// proper installation
/* uncomment as neccesary
$artisan->call('migrate', [
'--database' => 'testbench',
'--path' => 'migrations',
]);
*/

// call migrations specific to our tests, e.g. to seed the db
$artisan->call('migrate', [
'--database' => 'testbench',
'--path' => '../tests/migrations',
]);
}

/**
Expand All @@ -23,6 +50,9 @@ public function setUp()
*/
protected function getEnvironmentSetUp($app)
{
// reset base path to point to our package's src directory
$app[ 'path.base' ] = __DIR__ . '/../src' ;

$app['config']->set('database.default', 'testbench');
$app['config']->set('database.connections.testbench', array(
'driver' => 'sqlite',
Expand All @@ -31,6 +61,36 @@ protected function getEnvironmentSetUp($app)
));
}

/**
* Get package providers. At a minimum this is the package being tested, but also
* would include packages upon which our package depends, e.g. Cartalyst/Sentry
* In a normal app environment these would be added to the 'providers' array in
* the config/app.php file.
*
* @return array
*/
protected function getPackageProviders() {
return [
//'Cartalyst\Sentry\SentryServiceProvider',
//'YourProject\YourPackage\YourPackageServiceProvider',
];
}

/**
* Get package aliases. In a normal app environment these would be added to
* the 'aliases' array in the config/app.php file. If your package exposes an
* aliased facade, you should add the alias here, along with aliases for
* facades upon which your package depends, e.g. Cartalyst/Sentry
*
* @return array
*/
protected function getPackageAliases() {
return [
//'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry',
//'YourPackage' => 'YourProject\YourPackage\Facades\YourPackage',
];
}

/**
* Test running migration.
*
Expand Down

0 comments on commit 9435910

Please sign in to comment.