UserCheckerManagerTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 13
dl 0
loc 26
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A theUserCheckerManagerCallsAllCheckers() 0 19 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2019 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Component\AuthorizationEndpoint\Tests\User;
15
16
use OAuth2Framework\Component\AuthorizationEndpoint\AuthorizationRequest\AuthorizationRequest;
17
use OAuth2Framework\Component\AuthorizationEndpoint\User\UserAuthenticationChecker;
18
use OAuth2Framework\Component\AuthorizationEndpoint\User\UserAuthenticationCheckerManager;
19
use PHPUnit\Framework\TestCase;
20
use Prophecy\Argument;
21
use Prophecy\PhpUnit\ProphecyTrait;
22
23
/**
24
 * @group UserChecker
25
 * @group UserCheckerManager
26
 *
27
 * @internal
28
 */
29
final class UserCheckerManagerTest extends TestCase
30
{
31
    use ProphecyTrait;
32
33
    /**
34
     * @test
35
     */
36
    public function theUserCheckerManagerCallsAllCheckers()
37
    {
38
        $checker1 = $this->prophesize(UserAuthenticationChecker::class);
39
        $checker1->isAuthenticationNeeded(Argument::any(), Argument::any(), Argument::any())
40
            ->shouldBeCalled()
41
        ;
42
43
        $checker2 = $this->prophesize(UserAuthenticationChecker::class);
44
        $checker2->isAuthenticationNeeded(Argument::any(), Argument::any(), Argument::any())
45
            ->shouldBeCalled()
46
        ;
47
48
        $authorization = $this->prophesize(AuthorizationRequest::class);
49
50
        $manager = new UserAuthenticationCheckerManager();
51
        $manager->add($checker1->reveal());
52
        $manager->add($checker2->reveal());
53
54
        $manager->isAuthenticationNeeded($authorization->reveal());
55
    }
56
}
57