GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch master (f137da)
by Dmitri
01:44
created

AuthenticatorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Tests\Security\ApiKey;
6
7
use Damax\Bundle\ApiAuthBundle\Extractor\Extractor;
8
use Damax\Bundle\ApiAuthBundle\Security\AbstractAuthenticator;
9
use Damax\Bundle\ApiAuthBundle\Security\ApiKey\Authenticator;
10
use Damax\Bundle\ApiAuthBundle\Security\ApiKey\TokenUserProvider;
11
use PHPUnit\Framework\MockObject\MockObject;
12
use PHPUnit\Framework\TestCase;
13
use Symfony\Component\Security\Core\User\UserInterface;
14
use Symfony\Component\Security\Core\User\UserProviderInterface;
15
16
class AuthenticatorTest extends TestCase
17
{
18
    /**
19
     * @var AbstractAuthenticator
20
     */
21
    private $authenticator;
22
23
    protected function setUp()
24
    {
25
        /** @var Extractor $extractor */
26
        $extractor = $this->createMock(Extractor::class);
27
28
        $this->authenticator = new Authenticator($extractor);
29
    }
30
31
    /**
32
     * @test
33
     */
34
    public function it_retrieves_user_by_api_key()
35
    {
36
        $user = $this->authenticator->getUser('ABC', new TokenUserProvider(['user' => 'ABC']));
37
38
        $this->assertEquals('user', $user->getUsername());
39
    }
40
41
    /**
42
     * @test
43
     */
44
    public function it_retrieves_user_by_username()
45
    {
46
        /** @var UserInterface $user */
47
        $user = $this->createMock(UserInterface::class);
48
49
        /** @var UserProviderInterface|MockObject $provider */
50
        $provider = $this->createMock(UserProviderInterface::class);
51
52
        $provider
53
            ->expects($this->once())
54
            ->method('loadUserByUsername')
55
            ->with('ABC')
56
            ->willReturn($user)
57
        ;
58
59
        $this->assertSame($user, $this->authenticator->getUser('ABC', $provider));
60
    }
61
}
62