Passed
Push — master ( 85ac84...ca352a )
by Tobias
01:46
created

TestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A getEnvironmentSetUp() 0 4 1
A addApiRoutes() 0 7 1
1
<?php
2
3
namespace TobyMaxham\Helper\Tests;
4
5
use Orchestra\Testbench\TestCase as Orchestra;
6
use TobyMaxham\Helper\Http\Middleware\Cors;
7
8
/**
9
 * Class TestCase
10
 * @package TobyMaxham\Helper\Test
11
 * @author Tobias Maxham <[email protected]>
12
 */
13
class TestCase extends Orchestra
14
{
15
    protected function setUp()
16
    {
17
        parent::setUp();
18
    }
19
20
    protected function getEnvironmentSetUp($app)
21
    {
22
        $router = $app['router'];
23
        $this->addApiRoutes($router);
24
    }
25
26
    private function addApiRoutes($router)
27
    {
28
        $router->group(['middleware' => Cors::class], function () use ($router) {
29
            $router->get('api/ping', [
30
                'as' => 'api.ping',
31
                'uses' => function () {
32
                    return 'pong';
33
                }
34
            ]);
35
        });
36
    }
37
}
38