KeysControllerTest::testIndex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 7
c 2
b 1
f 1
dl 0
loc 12
rs 10
cc 1
nc 1
nop 0
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 = Container::getInstance();
20
        $container->set('hello.keys.public', CryptHelper::makeCryptKey('public'));
21
22
        $controller = new KeysController();
23
        /** @var JsonResponse $response */
24
        $response = $controller->callAction('index');
0 ignored issues
show
Bug introduced by
'index' of type string is incompatible with the type boolean expected by parameter $method of Nip\Controllers\Controller::callAction(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        $response = $controller->callAction(/** @scrutinizer ignore-type */ 'index');
Loading history...
25
26
        self::assertInstanceOf(JsonResponse::class, $response);
27
        $content = $response->getContent();
28
        self::assertJson($content);
29
    }
30
}
31