-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
120 additions
and
32 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
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
File renamed without changes.
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,61 @@ | ||
<?php | ||
|
||
namespace Tests\Regression\AlgoWeb\PODataLaravel; | ||
|
||
use Orchestra\Testbench\TestCase as BaseTestCase; | ||
|
||
class TestCase extends BaseTestCase | ||
{ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [ | ||
TestServiceProvider::class, | ||
\AlgoWeb\PODataLaravel\Providers\MetadataProvider::class, | ||
\AlgoWeb\PODataLaravel\Providers\MetadataRouteProvider::class, | ||
\AlgoWeb\PODataLaravel\Providers\QueryProvider::class, | ||
\AlgoWeb\PODataLaravel\Providers\MetadataControllerProvider::class, | ||
/*\Orchestra\Database\ConsoleServiceProvider::class,*/]; | ||
} | ||
|
||
|
||
/** | ||
* Define environment setup. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* @throws \ReflectionException | ||
* @return void | ||
*/ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
// Brute-force set app namespace | ||
$reflec = new \ReflectionClass($app); | ||
$prop = $reflec->getProperty('namespace'); | ||
$prop->setAccessible(true); | ||
$regressionName = explode('\\', get_class($this))[4]; | ||
$prop->setValue($app, __NAMESPACE__ . '\\' . $regressionName); | ||
$app['config']->set('testRegressionName', $regressionName); | ||
// Setup default database to use sqlite :memory: | ||
$app['config']->set('database.default', 'testbench'); | ||
$app['config']->set('database.connections.testbench', [ | ||
'driver' => 'sqlite', | ||
'database' => ':memory:', | ||
'prefix' => '', | ||
]); | ||
} | ||
|
||
public function setUp() : void | ||
{ | ||
parent::setUp(); | ||
//$this->loadMigrationsFrom(realpath(__DIR__ . '/database/migrations')); | ||
date_default_timezone_set('UTC'); | ||
} | ||
|
||
protected function assertSeeShim($result, $expected) | ||
{ | ||
if (method_exists($result, 'assertSee')) { | ||
$result->assertSee($expected); | ||
} else { | ||
$this->assertContains($expected, $result->response->getOriginalContent()); | ||
} | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
|
||
namespace Tests\Regression\AlgoWeb\PODataLaravel; | ||
|
||
use Illuminate\Support\ServiceProvider as BaseServiceProvider; | ||
|
||
class TestServiceProvider extends BaseServiceProvider | ||
{ | ||
protected $defer = false; | ||
|
||
public function register() | ||
{ | ||
} | ||
|
||
/** | ||
* @throws \Illuminate\Contracts\Container\BindingResolutionException | ||
*/ | ||
public function boot() | ||
{ | ||
$this->loadMigrationsFrom( | ||
__DIR__ . DIRECTORY_SEPARATOR . config('testRegressionName') .'/database/migrations' | ||
); | ||
} | ||
|
||
/** | ||
* @param array|string $path | ||
* @throws \Illuminate\Contracts\Container\BindingResolutionException | ||
*/ | ||
protected function loadMigrationsFrom($path) | ||
{ | ||
$migrator = $this->app->make('migrator'); | ||
$migrationRepository = $migrator->getRepository(); | ||
$migrationRepository->setSource('testbench'); | ||
$migrationRepository->createRepository(); | ||
$migrator->run($path); | ||
} | ||
} |