Completed
Push — 8.7 ( 735e8a...e29d62 )
by Markus
08:22 queued 05:11
created

Tests/Unit/Store/SessionSsoStateStoreTest.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DMK\MKSamlAuth\Tests\Unit\Store;
6
7
use DMK\MKSamlAuth\Session\PhpSession;
8
use DMK\MKSamlAuth\Store\SessionSsoStateStore;
9
use LightSaml\State\Sso\SsoState;
10
use PHPStan\Testing\TestCase;
0 ignored issues
show
The type PHPStan\Testing\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Prophecy\Argument;
12
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
13
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
14
15
class SessionSsoStateStoreTest extends TestCase
16
{
17
    /**
18
     * @var SessionSsoStateStore
19
     */
20
    private $store;
21
    /**
22
     * @var \Prophecy\Prophecy\ObjectProphecy
23
     */
24
    private $session;
25
26
    protected function setUp()
27
    {
28
        $this->session = $this->prophesize(PhpSession::class);
29
30
        $this->store = new SessionSsoStateStore($this->session->reveal());
31
    }
32
    public function testGet()
33
    {
34
        $state = new SsoState();
35
36
        $this->session->get('sso_state')
37
            ->willReturn(serialize($state));
38
39
        self::assertEquals($state, $this->store->get());
40
    }
41
42
    public function testGetNull()
43
    {
44
        $this->session->get('sso_state')
45
            ->willReturn(null);
46
47
        $this->session->set('sso_state', Argument::type('string'))
48
            ->shouldBeCalled();
49
50
        $this->session->getId()->willReturn('foo');
51
52
        self::assertInstanceOf(SsoState::class, $state = $this->store->get());
53
        self::assertSame('foo', $state->getLocalSessionId());
54
    }
55
}
56