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

TestCase::addApiRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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