Skip to content

Commit

Permalink
Avoid the need to use orchestra/database
Browse files Browse the repository at this point in the history
This depends on laravel/framework#22852 to be merged.

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jan 19, 2018
1 parent 2540a4b commit dcfca31
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
"require-dev": {
"laravel/framework": "~5.6.0",
"mockery/mockery": "~1.0",
"orchestra/database": "~3.6.0",
"phpunit/phpunit": "~6.0"
},
"suggest": {
"laravel/framework": "Required for testing (~5.6.0).",
"mockery/mockery": "Allow to use Mockery for testing (~1.0).",
"phpunit/phpunit": "Allow to use PHPUnit for testing (~6.0).",
"orchestra/database": "Allow to use --realpath migration for testing (~3.6).",
"orchestra/testbench-browser-kit": "Allow to use legacy Laravel BrowserKit for testing (~3.6).",
"orchestra/testbench-dusk": "Allow to use Laravel Dusk for testing (~3.6)."
},
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/WithLaravelMigrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected function loadLaravelMigrations($database): void
$options = is_array($database) ? $database : ['--database' => $database];

$options['--path'] = 'migrations';
$options['--realpath'] = true;

$this->artisan('migrate', $options);

Expand Down
11 changes: 4 additions & 7 deletions src/Concerns/WithLoadMigrationsFrom.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@ trait WithLoadMigrationsFrom
/**
* Define hooks to migrate the database before and after each test.
*
* @param string|array $realpah
* @param string|array $paths
*
* @return void
*/
protected function loadMigrationsFrom($realpath): void
protected function loadMigrationsFrom($paths): void
{
if (! class_exists(ConsoleServiceProvider::class)) {
throw new Exception('Missing `orchestra/database` in composer.json');
}

$options = is_array($realpath) ? $realpath : ['--realpath' => $realpath];
$options = is_array($paths) ? $paths : ['--path' => $paths];
$options['--realpath'] = true;

$this->artisan('migrate', $options);

Expand Down
1 change: 0 additions & 1 deletion tests/Databases/MigrateWithLaravelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ protected function getEnvironmentSetUp($app)
protected function getPackageProviders($app)
{
return [
\Orchestra\Database\ConsoleServiceProvider::class,
//'Cartalyst\Sentry\SentryServiceProvider',
//'YourProject\YourPackage\YourPackageServiceProvider',
];
Expand Down
1 change: 0 additions & 1 deletion tests/Databases/MigrateWithRealpathAndLaravelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ protected function getEnvironmentSetUp($app)
protected function getPackageProviders($app)
{
return [
\Orchestra\Database\ConsoleServiceProvider::class,
//'Cartalyst\Sentry\SentryServiceProvider',
//'YourProject\YourPackage\YourPackageServiceProvider',
];
Expand Down
1 change: 0 additions & 1 deletion tests/Databases/MigrateWithRealpathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected function getEnvironmentSetUp($app)
protected function getPackageProviders($app)
{
return [
\Orchestra\Database\ConsoleServiceProvider::class,
//'Cartalyst\Sentry\SentryServiceProvider',
//'YourProject\YourPackage\YourPackageServiceProvider',
];
Expand Down

0 comments on commit dcfca31

Please sign in to comment.