KernelWrapperTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testKernelWrapper() 0 19 1
1
<?php
2
3
namespace PHPFastCGI\SpeedfonyBundle\Tests\Bridge;
4
5
use PHPFastCGI\FastCGIDaemon\Http\Request;
6
use PHPFastCGI\SpeedfonyBundle\Bridge\KernelWrapper;
7
use PHPFastCGI\SpeedfonyBundle\Tests\Helper\MockKernel;
8
use Symfony\Component\HttpFoundation\Request as HttpFoundationRequest;
9
use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse;
10
11
class KernelWrapperTest extends \PHPUnit_Framework_TestCase
12
{
13
    public function testKernelWrapper()
14
    {
15
        $stream  = fopen('php://temp', 'r');
16
        $request = new Request(['REQUEST_URI' => '/hello'], $stream);
17
18
        $symfonyResponse = new HttpFoundationResponse('Hello World');
19
20
        $kernel = new MockKernel(function (HttpFoundationRequest $symfonyRequest) use ($symfonyResponse) {
21
            $this->assertEquals('/hello', $symfonyRequest->getRequestUri());
22
    
23
            return $symfonyResponse;
24
        });
25
26
        $kernelWrapper = new KernelWrapper($kernel);
27
28
        $this->assertEquals($symfonyResponse, $kernelWrapper->handleRequest($request));
29
30
        fclose($stream);
31
    }
32
}
33