TestCase   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 44
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A createApplication() 0 16 1
1
<?php
2
3
namespace App\Ship\Parents\Tests\PhpUnit;
4
5
use Apiato\Core\Abstracts\Tests\PhpUnit\TestCase as AbstractTestCase;
6
use Faker\Generator;
7
use Illuminate\Contracts\Console\Kernel as ApiatoConsoleKernel;
8
9
/**
10
 * Class TestCase
11
 *
12
 * @author  Mahmoud Zalt  <[email protected]>
13
 */
14
abstract class TestCase extends AbstractTestCase
15
{
16
17
    /**
18
     * Setup the test environment, before each test.
19
     *
20
     * @return void
21
     */
22
    public function setUp()
23
    {
24
        parent::setUp();
25
    }
26
27
    /**
28
     * Reset the test environment, after each test.
29
     */
30
    public function tearDown()
31
    {
32
        parent::tearDown();
33
    }
34
35
    /**
36
     * Creates the application.
37
     *
38
     * @return \Illuminate\Foundation\Application
39
     */
40
    public function createApplication()
41
    {
42
        $this->baseUrl = env('API_FULL_URL'); // this reads the value from `phpunit.xml` during testing
43
44
        // override the default subDomain of the base URL when subDomain property is declared inside a test
45
        $this->overrideSubDomain();
46
47
        $app = require __DIR__ . '/../../../../../bootstrap/app.php';
48
49
        $app->make(ApiatoConsoleKernel::class)->bootstrap();
50
51
        // create instance of faker and make it available in all tests
52
        $this->faker = $app->make(Generator::class);
53
54
        return $app;
55
    }
56
57
}
58