-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathSpreadListCommand.php
More file actions
54 lines (41 loc) · 1.85 KB
/
SpreadListCommand.php
File metadata and controls
54 lines (41 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Spy\TimelineBundle\Tests\Units\Command;
use atoum\atoum;
use Spy\TimelineBundle\Command\SpreadListCommand as TestedCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
class SpreadListCommand extends atoum\test
{
public function beforeTestMethod($method)
{
define('STDIN', fopen("php://stdin", "r"));
}
public function testExecute()
{
$this->mockGenerator()->orphanize('__construct');
$deployer = new \mock\Spy\Timeline\Spread\Deployer();
$deployer->getMockController()->getSpreads = array();
$container = new \mock\Symfony\Component\DependencyInjection\ContainerInterface();
$container->getMockController()->get = function ($v) use ($deployer) {
if ($v == 'spy_timeline.spread.deployer') {
return $deployer;
}
};
$command = new TestedCommand();
$command->setContainer($container);
$application = new Application();
$application->add($command);
$command = $application->find('spy_timeline:spreads');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()), array());
$this->string($commandTester->getDisplay())
->isEqualTo('There is 0 timeline spread(s) defined'.PHP_EOL);
// one spread
$spread = new \mock\Spy\TimelineBundle\Spread\SpreadInterface();
$deployer->getMockController()->getSpreads = array($spread);
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()), array());
$this->string($commandTester->getDisplay())
->isEqualTo('There is 1 timeline spread(s) defined'.PHP_EOL.'- mock\Spy\TimelineBundle\Spread\SpreadInterface'.PHP_EOL);
}
}