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.
Completed
Push — 4.2-to-master ( ed215f )
by E
06:47
created

GenerateCommandExecuteTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
B testExecute() 0 26 1
A testExecuteWithError() 0 16 1
1
<?php declare(strict_types=1);
2
3
namespace ApiGen\Tests\Console\Command;
4
5
use ApiGen\Console\Command\GenerateCommand;
6
use ApiGen\Tests\AbstractContainerAwareTestCase;
7
use ApiGen\Tests\MethodInvoker;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\ConsoleOutput;
10
use Symfony\Component\Console\Output\NullOutput;
11
use Symfony\Component\Console\Output\Output;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
final class GenerateCommandExecuteTest extends AbstractContainerAwareTestCase
15
{
16
    /**
17
     * @var GenerateCommand
18
     */
19
    private $generateCommand;
20
21
    protected function setUp(): void
22
    {
23
        $this->generateCommand = $this->container->getByType(GenerateCommand::class);
24
25
        /** @var ConsoleOutput $output */
26
        $output = $this->container->getByType(OutputInterface::class);
27
        $output->setVerbosity(Output::VERBOSITY_QUIET);
28
    }
29
30
    public function testExecute(): void
31
    {
32
        $this->assertFileNotExists(TEMP_DIR . '/api/index.html');
33
34
        $inputMock = $this->createMock(InputInterface::class);
35
        $inputMock->method('getArgument')->willReturn([
36
            __DIR__ . '/Source'
37
        ]);
38
        $inputMock->method('getOptions')->willReturn([
39
            'config' => null,
40
            'destination' => TEMP_DIR . '/api',
41
            'source' => __DIR__ . '/Source'
42
        ]);
43
        $outputMock = $this->createMock(OutputInterface::class);
44
45
        $this->assertSame(
46
            0, // success
47
            MethodInvoker::callMethodOnObject(
48
                $this->generateCommand,
49
                'execute',
50
                [$inputMock, $outputMock]
51
            )
52
        );
53
54
        $this->assertFileExists(TEMP_DIR . '/api/index.html');
55
    }
56
57
    /**
58
     * @expectedException \ApiGen\Configuration\Exceptions\ConfigurationException
59
     */
60
    public function testExecuteWithError(): void
61
    {
62
        $inputMock = $this->createMock(InputInterface::class);
63
        $inputMock->method('getArgument')->willReturn([
64
            __DIR__
65
        ]);
66
        $inputMock->method('getOptions')->willReturn([
67
            'config' => null
68
        ]);
69
70
        MethodInvoker::callMethodOnObject(
71
            $this->generateCommand,
72
            'execute',
73
            [$inputMock, new NullOutput()]
74
        );
75
    }
76
}
77