Passed
Pull Request — master (#10)
by Anatoly
02:48
created

HomeControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testHandle() 0 12 1
1
<?php declare(strict_types=1);
2
3
namespace App\Tests\Controller;
4
5
/**
6
 * Import classes
7
 */
8
use App\Tests\ContainerAwareTrait;
9
use PHPUnit\Framework\TestCase;
10
use Sunrise\Http\ServerRequest\ServerRequestFactory;
11
12
/**
13
 * HomeControllerTest
14
 */
15
class HomeControllerTest extends TestCase
16
{
17
    use ContainerAwareTrait;
18
19
    /**
20
     * @var string
21
     */
22
    private const ROUTE_NAME = 'home';
23
24
    /**
25
     * @return void
26
     *
27
     * @runInSeparateProcess
28
     */
29
    public function testHandle() : void
30
    {
31
        $container = $this->getContainer();
32
33
        $request = (new ServerRequestFactory)
34
            ->createServerRequest('GET', '/home');
35
36
        $response = $container->get('router')
37
            ->getRoute(self::ROUTE_NAME)
38
            ->handle($request);
39
40
        $this->assertSame(200, $response->getStatusCode());
41
    }
42
}
43