Test Failed
Push — master ( d8d5ef...b9f7fc )
by mcfog
01:56
created

MiddlewareIncluedHandlerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMiddlewareIncluedHandler() 0 17 1
1
<?php
2
3
namespace Nimo\Tests;
4
5
use Nimo\Handlers\CallableHandler;
6
use Nimo\Handlers\MiddlewareIncluedHandler;
7
use PHPUnit\Framework\Assert;
8
9
class MiddlewareIncluedHandlerTest extends NimoTestCase
10
{
11
12
    public function testMiddlewareIncluedHandler()
13
    {
14
        $wrappedHandler = $this->throwHandler();
15
        $request = $this->getRequestMock();
16
        $response = $this->getResponseMock();
17
        $middleware = $this->assertedMiddleware($request, $wrappedHandler, $response);
0 ignored issues
show
Documentation introduced by
$request is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Psr\Http\Message\ServerRequestInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$response is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Psr\Http\Message\ResponseInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
18
19
        /**
20
         * @var CallableHandler $wrappedHandler
21
         */
22
        $handler = $wrappedHandler->includeMiddleware($middleware);
23
        Assert::assertInstanceOf(MiddlewareIncluedHandler::class, $handler);
24
25
        $actualResponse = $handler->handle($request);
0 ignored issues
show
Documentation introduced by
$request is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Psr\Http\Message\ServerRequestInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
26
        Assert::assertSame($response, $actualResponse);
27
28
    }
29
}
30