Completed
Pull Request — master (#77)
by Evgeny
11:21 queued 06:43
created

ClearInvalidRefreshTokensCommandSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 31
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_is_a_command() 0 4 1
A it_has_a_name() 0 4 1
A it_clears_invalid_refresh_tokens() 0 8 1
1
<?php
2
3
namespace spec\Gesdinet\JWTRefreshTokenBundle\Command;
4
5
use Gesdinet\JWTRefreshTokenBundle\Command\ClearInvalidRefreshTokensCommand;
6
use Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenInterface;
7
use Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenManagerInterface;
8
use PhpSpec\ObjectBehavior;
9
use Prophecy\Argument;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class ClearInvalidRefreshTokensCommandSpec extends ObjectBehavior
15
{
16
    public function let(RefreshTokenManagerInterface $refreshTokenManager)
17
    {
18
        $this->beConstructedWith($refreshTokenManager);
19
    }
20
21
    public function it_is_initializable()
22
    {
23
        $this->shouldHaveType(ClearInvalidRefreshTokensCommand::class);
24
    }
25
26
    public function it_is_a_command()
27
    {
28
        $this->shouldHaveType(Command::class);
29
    }
30
31
    public function it_has_a_name()
32
    {
33
        $this->getName()->shouldReturn('gesdinet:jwt:clear');
34
    }
35
36
    public function it_clears_invalid_refresh_tokens(InputInterface $input, OutputInterface $output, RefreshTokenManagerInterface $refreshTokenManager, RefreshTokenInterface $revokedToken)
37
    {
38
        $refreshTokenManager->revokeAllInvalid(Argument::any())->shouldBeCalled()->willReturn(array($revokedToken));
39
40
        $output->writeln(Argument::any())->shouldBeCalled();
41
42
        $this->run($input, $output);
43
    }
44
}
45