|
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; |
|
|
|
|
|
|
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 |
|
|
|
|
|
|
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
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths