Completed
Push — master ( a70ca1...835655 )
by Jafar
06:00
created

KeysGeneratorCommandTest::testCommand()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Guarded Authentication package.
4
 *
5
 * (c) Jafar Jabr <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Jafar\Bundle\GuardedAuthenticationBundle\Tests\Command;
12
13
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Jafar\Bundle\GuardedAuthenticationBundle\Command\KeysGeneratorCommand;
15
use Symfony\Bundle\FrameworkBundle\Console\Application;
16
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
17
use Symfony\Component\Console\Tester\CommandTester;
18
19
/**
20
 * Class KeysGeneratorCommandTest.
21
 *
22
 * @author Jafar Jabr <[email protected]>
23
 */
24
class KeysGeneratorCommandTest extends KernelTestCase
25
{
26
    /**
27
     * Test command.
28
     */
29
    public function testCommand()
30
    {
31
        $kernel = self::bootKernel();
32
        $application = new Application($kernel);
33
34
        $application->add(new KeysGeneratorCommand());
35
36
        $command = $application->find('jafar:generate-keys');
37
38
        $commandTester = new CommandTester($command);
39
40
        // Equals to a user inputting "Test" and hitting ENTER
41
        $commandTester->setInputs(array('Test'));
42
43
//        // Equals to a user inputting "This", "That" and hitting ENTER
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
//        // This can be used for answering two separated questions for instance
45
//        $commandTester->setInputs(array('This', 'That'));
46
//
47
//        // For simulating a positive answer to a confirmation question, adding an
48
//        // additional input saying "yes" will work
49
//        $commandTester->setInputs(array('yes'));
50
51
        $this->assertEquals(0, $commandTester->execute([]));
52
        $this->assertContains('The configuration seems correct.', $commandTester->getDisplay());
53
    }
54
}
55