CreateResponseActionTest::testCreatesResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace LightSaml\Idp\Tests\Action\Profile\Outbound\Response;
4
5
use LightSaml\Context\Profile\ProfileContext;
6
use LightSaml\Idp\Action\Profile\Outbound\Response\CreateResponseAction;
7
use LightSaml\Model\Protocol\Response;
8
use LightSaml\Profile\Profiles;
9
use Psr\Log\LoggerInterface;
10
11
class CreateResponseActionTest extends \PHPUnit_Framework_TestCase
12
{
13
    public function testCreatesResponse()
14
    {
15
        $context = new ProfileContext(Profiles::SSO_IDP_RECEIVE_AUTHN_REQUEST, ProfileContext::ROLE_IDP);
16
        $action = new CreateResponseAction($this->getLoggerMock());
0 ignored issues
show
Bug introduced by
It seems like $this->getLoggerMock() targeting LightSaml\Idp\Tests\Acti...onTest::getLoggerMock() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, LightSaml\Action\Profile...leAction::__construct() does only seem to accept object<Psr\Log\LoggerInterface>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
17
        $action->execute($context);
18
19
        $this->assertInstanceOf(Response::class, $context->getOutboundMessage());
20
    }
21
22
    /**
23
     * @return \PHPUnit_Framework_MockObject_MockObject|\Psr\Log\LoggerInterface
24
     */
25
    private function getLoggerMock()
26
    {
27
        return $this->getMock(LoggerInterface::class);
28
    }
29
}
30