-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create possible breaking changes because many package developer think…
… "stable" dependency is the way to go when developing package. If you need to use `--realpath` migration for whatever reason, run `composer require --dev "orchestra/database=~3.1"` and be damn sure you set your minimum-stability to dev. /end of rant Signed-off-by: crynobone <[email protected]>
- Loading branch information
Showing
15 changed files
with
207 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests; | ||
|
||
class DatabaseWithCustomMigrationFixtureTest extends \Orchestra\Testbench\TestCase | ||
{ | ||
/** | ||
* Setup the test environment. | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
// 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 | ||
$this->loadMigrationsFrom([ | ||
'--database' => 'testbench', | ||
'--path' => '../vendor/cartalyst/sentry/src/migrations', | ||
]); | ||
*/ | ||
|
||
// call migrations specific to our tests, e.g. to seed the db | ||
// the path option should be relative to the 'path.database' | ||
// path unless `--path` option is available. | ||
$this->loadMigrationsFrom([ | ||
'--database' => 'testing', | ||
'--realpath' => realpath(__DIR__.'/migrations'), | ||
]); | ||
} | ||
|
||
/** | ||
* Define environment setup. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* | ||
* @return void | ||
*/ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
$app['config']->set('database.default', 'testing'); | ||
} | ||
|
||
/** | ||
* 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. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* | ||
* @return array | ||
*/ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [ | ||
\Orchestra\Database\ConsoleServiceProvider::class, | ||
//'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. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* | ||
* @return array | ||
*/ | ||
protected function getPackageAliases($app) | ||
{ | ||
return [ | ||
//'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry', | ||
//'YourPackage' => 'YourProject\YourPackage\Facades\YourPackage', | ||
]; | ||
} | ||
|
||
/** | ||
* Test running migration. | ||
* | ||
* @test | ||
*/ | ||
public function testRunningMigration() | ||
{ | ||
$users = \DB::table('users')->where('id', '=', 1)->first(); | ||
|
||
$this->assertEquals('[email protected]', $users->email); | ||
$this->assertTrue(\Hash::check('123', $users->password)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
class ChildServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app['child.loaded'] = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
class Controller extends \Illuminate\Routing\Controller | ||
{ | ||
public function index() | ||
{ | ||
return 'Controller@index'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
class DeferredChildServiceProvider extends ServiceProvider | ||
{ | ||
protected $defer = true; | ||
|
||
public function register() | ||
{ | ||
$this->app['child.deferred.loaded'] = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
use Illuminate\Support\AggregateServiceProvider; | ||
|
||
class ParentServiceProvider extends AggregateServiceProvider | ||
{ | ||
protected $providers = [ | ||
ChildServiceProvider::class, | ||
DeferredChildServiceProvider::class, | ||
]; | ||
|
||
public function register() | ||
{ | ||
parent::register(); | ||
|
||
$this->app['parent.loaded'] = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
class ServiceProvider extends \Illuminate\Support\ServiceProvider | ||
{ | ||
public function boot() | ||
{ | ||
$this->loadMigrationsFrom(realpath(__DIR__.'/../migrations')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Stubs; | ||
|
||
class TestCase extends \Orchestra\Testbench\TestCase | ||
{ | ||
// | ||
} |
Oops, something went wrong.