Failed Conditions
Push — ng ( 7370de...a36c25 )
by Florent
19:12
created

TrustedIssuerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A genericCalls() 0 11 1
A theIssuerIsNotSupported() 0 5 1
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\Server\JwtBearerGrant\Tests;
15
16
use OAuth2Framework\Component\Server\JwtBearerGrant\TrustedIssuer;
17
use OAuth2Framework\Component\Server\JwtBearerGrant\TrustedIssuerManager;
18
use PHPUnit\Framework\TestCase;
19
20
/**
21
 * @group GrantType
22
 * @group JwtBearer
23
 */
24
final class TrustedIssuerTest extends TestCase
25
{
26
    /**
27
     * @test
28
     */
29
    public function genericCalls()
30
    {
31
        $manager = new TrustedIssuerManager();
32
        $issuer = $this->prophesize(TrustedIssuer::class);
33
        $issuer->name()->willReturn('foo');
34
35
        $manager->add($issuer->reveal());
36
        self::assertEquals(['foo'], $manager->list());
37
        self::assertTrue($manager->has('foo'));
38
        self::assertInstanceOf(TrustedIssuer::class, $manager->get('foo'));
39
    }
40
41
    /**
42
     * @test
43
     * @expectedException \InvalidArgumentException
44
     * @expectedExceptionMessage The issuer with name "foo" is not known.
45
     */
46
    public function theIssuerIsNotSupported()
47
    {
48
        $manager = new TrustedIssuerManager();
49
        $manager->get('foo');
50
    }
51
}
52