Completed
Pull Request — master (#194)
by Alex
10:03 queued 03:31
created

TestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 52
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A getPackageProviders() 0 8 1
A resolveApplicationConsoleKernel() 0 3 1
A getEnvironmentSetUp() 0 14 1
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)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

16
    protected function getPackageProviders(/** @scrutinizer ignore-unused */ $app)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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