Test Failed
Push — master ( a6b51e...5fffdb )
by Gabriel
08:05
created

KeysControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIndex() 0 14 1
1
<?php
2
3
namespace ByTIC\Hello\Tests\Modules\Oauth\Controllers;
4
5
use ByTIC\Hello\Modules\Oauth\Controllers\KeysController;
6
use ByTIC\Hello\Tests\AbstractTest;
7
use ByTIC\Hello\Utility\CryptHelper;
8
use Nip\Container\Container;
9
use Nip\Http\Response\JsonResponse;
10
11
/**
12
 * Class KeysControllerTest
13
 * @package ByTIC\Hello\Tests\Modules\Oauth\Controllers
14
 */
15
class KeysControllerTest extends AbstractTest
16
{
17
    public function testIndex()
18
    {
19
        $container = new Container();
20
        $container->set('hello.keys.public', CryptHelper::makeCryptKey('public'));
21
        Container::setInstance($container);
22
23
        $controller = new KeysController();
24
        /** @var JsonResponse $response */
25
        $response = $controller->callAction('index');
0 ignored issues
show
Documentation introduced by
'index' is of type string, but the function expects a boolean.

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
27
        self::assertInstanceOf(JsonResponse::class, $response);
28
        $content = $response->getContent();
29
        self::assertJson($content);
30
    }
31
}
32