|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: alex |
|
5
|
|
|
* Date: 1/02/20 |
|
6
|
|
|
* Time: 1:21 PM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace AlgoWeb\PODataLaravel\Orchestra\Tests; |
|
10
|
|
|
|
|
11
|
|
|
use AlgoWeb\PODataLaravel\Kernels\ConsoleKernel; |
|
12
|
|
|
use Orchestra\Testbench\TestCase as BaseTestCase; |
|
13
|
|
|
|
|
14
|
|
|
class TestCase extends BaseTestCase |
|
15
|
|
|
{ |
|
16
|
|
|
protected function getPackageProviders($app) |
|
|
|
|
|
|
17
|
|
|
{ |
|
18
|
|
|
return [ |
|
19
|
|
|
TestServiceProvider::class, |
|
20
|
|
|
\AlgoWeb\PODataLaravel\Providers\MetadataProvider::class, |
|
21
|
|
|
\AlgoWeb\PODataLaravel\Providers\MetadataRouteProvider::class, |
|
22
|
|
|
\AlgoWeb\PODataLaravel\Providers\QueryProvider::class, |
|
23
|
|
|
\AlgoWeb\PODataLaravel\Providers\MetadataControllerProvider::class]; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Resolve application Console Kernel implementation. |
|
28
|
|
|
* |
|
29
|
|
|
* @param \Illuminate\Foundation\Application $app |
|
30
|
|
|
* @return void |
|
31
|
|
|
*/ |
|
32
|
|
|
protected function resolveApplicationConsoleKernel($app) |
|
33
|
|
|
{ |
|
34
|
|
|
$app->singleton('Illuminate\Contracts\Console\Kernel', ConsoleKernel::class); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Define environment setup. |
|
39
|
|
|
* |
|
40
|
|
|
* @param \Illuminate\Foundation\Application $app |
|
41
|
|
|
* @return void |
|
42
|
|
|
* @throws \ReflectionException |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function getEnvironmentSetUp($app) |
|
45
|
|
|
{ |
|
46
|
|
|
// Brute-force set app namespace |
|
47
|
|
|
$reflec = new \ReflectionClass($app); |
|
48
|
|
|
$prop = $reflec->getProperty('namespace'); |
|
49
|
|
|
$prop->setAccessible(true); |
|
50
|
|
|
$prop->setValue($app, "AlgoWeb\\PODataLaravel\\Orchestra\\"); |
|
51
|
|
|
|
|
52
|
|
|
// Setup default database to use sqlite :memory: |
|
53
|
|
|
$app['config']->set('database.default', 'testbench'); |
|
54
|
|
|
$app['config']->set('database.connections.testbench', [ |
|
55
|
|
|
'driver' => 'sqlite', |
|
56
|
|
|
'database' => ':memory:', |
|
57
|
|
|
'prefix' => '', |
|
58
|
|
|
]); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setUp() |
|
62
|
|
|
{ |
|
63
|
|
|
parent::setUp(); |
|
64
|
|
|
//$this->loadMigrationsFrom(__DIR__ . '/database/migrations'); |
|
65
|
|
|
date_default_timezone_set('UTC'); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.