|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the core-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2019 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Bundle\CoreBundle\Tests\Command; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
15
|
|
|
use Symfony\Component\Console\Tester\CommandTester; |
|
16
|
|
|
use WBW\Bundle\CoreBundle\Command\CopySkeletonCommand; |
|
17
|
|
|
use WBW\Bundle\CoreBundle\Tests\AbstractWebTestCase; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Copy skeleton command test. |
|
21
|
|
|
* |
|
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
23
|
|
|
* @package WBW\Bundle\CoreBundle\Tests\Command |
|
24
|
|
|
*/ |
|
25
|
|
|
class CopySkeletonCommandWebTest extends AbstractWebTestCase { |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Tests the execute() method. |
|
29
|
|
|
* |
|
30
|
|
|
* @return void |
|
31
|
|
|
*/ |
|
32
|
|
|
public function testExecute(): void { |
|
33
|
|
|
|
|
34
|
|
|
// Set an Application mock. |
|
35
|
|
|
$application = new Application(static::$kernel); |
|
36
|
|
|
$application->add(new CopySkeletonCommand()); |
|
37
|
|
|
|
|
38
|
|
|
// Set a Command mock. |
|
39
|
|
|
$command = $application->find("wbw:core:copy-skeleton"); |
|
40
|
|
|
|
|
41
|
|
|
// Set a Command tester. |
|
42
|
|
|
$commandTester = new CommandTester($command); |
|
43
|
|
|
|
|
44
|
|
|
$res = $commandTester->execute([ |
|
45
|
|
|
"command" => $command->getName(), |
|
46
|
|
|
]); |
|
47
|
|
|
$this->assertEquals(0, $res); |
|
48
|
|
|
|
|
49
|
|
|
$output = $commandTester->getDisplay(); |
|
50
|
|
|
$this->assertStringContainsString("Trying to copy skeletons", $output); |
|
51
|
|
|
$this->assertStringContainsString("[OK] No skeleton were provided by any bundle", $output); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|