Failed Conditions
Push — master ( 7c3864...930f9b )
by Florent
14:15
created

theUserCheckerManagerCallsAllCheckers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 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
22
/**
23
 * @group UserChecker
24
 * @group UserCheckerManager
25
 */
26
final class UserCheckerManagerTest extends TestCase
27
{
28
    /**
29
     * @test
30
     */
31
    public function theUserCheckerManagerCallsAllCheckers()
32
    {
33
        $checker1 = $this->prophesize(UserAuthenticationChecker::class);
34
        $checker1->isAuthenticationNeeded(Argument::any(), Argument::any(), Argument::any())
35
            ->shouldBeCalled();
36
37
        $checker2 = $this->prophesize(UserAuthenticationChecker::class);
38
        $checker2->isAuthenticationNeeded(Argument::any(), Argument::any(), Argument::any())
39
            ->shouldBeCalled();
40
41
        $authorization = $this->prophesize(AuthorizationRequest::class);
42
43
        $manager = new UserAuthenticationCheckerManager();
44
        $manager->add($checker1->reveal());
45
        $manager->add($checker2->reveal());
46
47
        $manager->isAuthenticationNeeded($authorization->reveal());
48
    }
49
}
50