Completed
Push — master ( 9c2e57...960d6d )
by Zura
03:25
created

TestCase   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 70
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 1
A getPackageProviders() 0 6 1
A getPackageAliases() 0 6 1
A getEnvironmentSetUp() 0 12 1
A setUpDatabase() 0 6 1
A seedUsers() 0 8 1
A updateConfig() 0 4 1
1
<?php
2
3
namespace Gabievi\Promocodes\Tests;
4
5
use Gabievi\Promocodes\Tests\Models\User;
6
use Orchestra\Testbench\TestCase as Orchestra;
7
8
abstract class TestCase extends Orchestra
9
{
10
    //
11
    public function setUp()
12
    {
13
        parent::setUp();
14
15
        $this->loadLaravelMigrations(['--database' => 'sqlite']);
16
17
        $this->seedUsers();
18
19
        $this->setUpDatabase();
20
21
        $this->updateConfig();
22
    }
23
24
    //
25
    protected function getPackageProviders($app)
26
    {
27
        return [
28
            \Gabievi\Promocodes\ServiceProvider::class
29
        ];
30
    }
31
32
    //
33
    protected function getPackageAliases($app)
34
    {
35
        return [
36
            'Promocodes' => \Gabievi\Promocodes\Facades\Promocodes::class,
37
        ];
38
    }
39
40
    //
41
    protected function getEnvironmentSetUp($app)
42
    {
43
        $app['config']->set('database.default', 'sqlite');
44
        $app['config']->set('database.connections.sqlite', [
45
            'driver' => 'sqlite',
46
            'database' => ':memory:',
47
            'prefix' => '',
48
        ]);
49
50
51
        $app['config']->set('app.key', 'dwFcFNf8J3fJ3RYADQbWMHyNx8YK');
52
    }
53
54
    //
55
    protected function setUpDatabase()
56
    {
57
        include_once __DIR__.'/../migrations/2016_05_17_221000_create_promocodes_table.php';
58
59
        (new \CreatePromocodesTable)->up();
60
    }
61
62
    //
63
    protected function seedUsers()
64
    {
65
        User::create([
66
            'name' => 'user',
67
            'email' => '[email protected]',
68
            'password' => 'secret'
69
        ]);
70
    }
71
72
    //
73
    protected function updateConfig()
74
    {
75
        $this->app['config']->set('promocodes.user_model', User::class);
76
    }
77
}
78