|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace DMK\MKSamlAuth\Tests\Unit\Store; |
|
6
|
|
|
|
|
7
|
|
|
use DMK\MKSamlAuth\Store\SessionSsoStateStore; |
|
8
|
|
|
use LightSaml\State\Sso\SsoState; |
|
9
|
|
|
use PHPStan\Testing\TestCase; |
|
|
|
|
|
|
10
|
|
|
use Prophecy\Argument; |
|
11
|
|
|
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; |
|
12
|
|
|
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; |
|
13
|
|
|
|
|
14
|
|
|
class SessionSsoStateStoreTest extends TestCase |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @var SessionSsoStateStore |
|
18
|
|
|
*/ |
|
19
|
|
|
private $store; |
|
20
|
|
|
/** |
|
21
|
|
|
* @var \Prophecy\Prophecy\ObjectProphecy |
|
22
|
|
|
*/ |
|
23
|
|
|
private $user; |
|
24
|
|
|
|
|
25
|
|
|
protected function setUp() |
|
26
|
|
|
{ |
|
27
|
|
|
$this->user = $this->prophesize(FrontendUserAuthentication::class); |
|
28
|
|
|
|
|
29
|
|
|
$fe = $this->prophesize(TypoScriptFrontendController::class); |
|
30
|
|
|
$fe->fe_user = $this->user->reveal(); |
|
31
|
|
|
$GLOBALS['TSFE'] = $fe->reveal(); |
|
32
|
|
|
|
|
33
|
|
|
$this->store = new SessionSsoStateStore(); |
|
|
|
|
|
|
34
|
|
|
} |
|
35
|
|
|
public function testGet() |
|
36
|
|
|
{ |
|
37
|
|
|
$state = new SsoState(); |
|
38
|
|
|
|
|
39
|
|
|
$this->user->getSessionData(SessionSsoStateStore::SESSION_KEY) |
|
40
|
|
|
->willReturn(serialize($state)); |
|
41
|
|
|
|
|
42
|
|
|
self::assertEquals($state, $this->store->get()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testGetNull() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->user->getSessionData(SessionSsoStateStore::SESSION_KEY) |
|
48
|
|
|
->willReturn(null); |
|
49
|
|
|
|
|
50
|
|
|
$this->user->setAndSaveSessionData(SessionSsoStateStore::SESSION_KEY, Argument::type('string')) |
|
51
|
|
|
->shouldBeCalled(); |
|
52
|
|
|
|
|
53
|
|
|
$this->user->getSessionId()->willReturn('foo'); |
|
54
|
|
|
|
|
55
|
|
|
self::assertInstanceOf(SsoState::class, $state = $this->store->get()); |
|
56
|
|
|
self::assertSame('foo', $state->getLocalSessionId()); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths