Completed
Push — master ( 7c1eaa...80d841 )
by Joachim
15:53
created

SyncTerminalsCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 24
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExecute() 0 21 1
1
<?php
2
3
namespace Loevgaard\DandomainAltapayBundle\Tests\Command;
4
5
use Loevgaard\AltaPay\Client;
6
use Loevgaard\DandomainAltapayBundle\Command\SyncTerminalsCommand;
7
use Loevgaard\DandomainAltapayBundle\Manager\TerminalManager;
8
use Loevgaard\DandomainAltapayBundle\Synchronizer\TerminalSynchronizer;
9
use PHPUnit\Framework\TestCase;
10
use Symfony\Component\Console\Application;
11
use Symfony\Component\Console\Tester\CommandTester;
12
13
class SyncTerminalsCommandTest extends TestCase
14
{
15
    public function testExecute()
16
    {
17
        $terminalManager = $this->createMock(TerminalManager::class);
18
        $altapayClient = $this->createMock(Client::class);
19
        $terminalSynchronizer = new TerminalSynchronizer($terminalManager, $altapayClient);
20
21
        $command = new SyncTerminalsCommand();
22
        $command->setTerminalSynchronizer($terminalSynchronizer);
23
24
        $application = new Application();
25
        $application->setAutoExit(false);
26
        $application->add($command);
27
28
        $command = $application->find('loevgaard:dandomain:altapay:sync-terminals');
29
        $commandTester = new CommandTester($command);
30
        $exitCode = $commandTester->execute([
31
            'command' => $command->getName(),
32
        ]);
33
34
        $this->assertSame(0, $exitCode, 'Returns 0 in case of success');
35
    }
36
}
37