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

ClearInvalidRefreshTokensCommandSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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