EnricherRegistryTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace DMK\MKSamlAuth\Tests\Unit;
5
6
use DMK\MKSamlAuth\Enricher\SamlHostnameEnricher;
7
use DMK\MKSamlAuth\EnricherRegistry;
8
use DMK\MKSamlAuth\Model\FrontendUser;
9
use PHPUnit\Framework\TestCase;
10
use TYPO3\CMS\Core\Utility\GeneralUtility;
11
12
class EnricherRegistryTest extends TestCase
13
{
14
    /**
15
     * @var EnricherRegistry
16
     */
17
    private $registry;
18
19
    protected function setUp()
20
    {
21
        $this->registry = new EnricherRegistry();
22
    }
23
24
    public function testProcess()
25
    {
26
        $user = $this->prophesize(FrontendUser::class);
27
28
        $enricher = $this->prophesize(SamlHostnameEnricher::class);
29
        $enricher->process($user->reveal(), []);
30
31
        GeneralUtility::addInstance(SamlHostnameEnricher::class, $enricher->reveal());
32
        EnricherRegistry::register(SamlHostnameEnricher::class);
33
34
        $this->registry->process($user->reveal(), []);
35
    }
36
37
    /**
38
     * @expectedException LogicException
39
     * @expectedExceptionMessage The class "stdClass" does not implements "DMK\MKSamlAuth\Enricher\EnricherInterface".
40
     */
41
    public function testRegisterWithWrongClass()
42
    {
43
        EnricherRegistry::register(\stdClass::class);
44
    }
45
}
46