forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleApplicationTest.php
More file actions
executable file
·66 lines (49 loc) · 2.01 KB
/
ConsoleApplicationTest.php
File metadata and controls
executable file
·66 lines (49 loc) · 2.01 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
55
56
57
58
59
60
61
62
63
64
65
66
<?php
use Mockery as m;
class ConsoleApplicationTest extends PHPUnit_Framework_TestCase {
public function tearDown()
{
m::close();
}
public function testAddSetsLaravelInstance()
{
$app = $this->getMock('Illuminate\Console\Application', array('addToParent'));
$app->setLaravel('foo');
$command = m::mock('Illuminate\Console\Command');
$command->shouldReceive('setLaravel')->once()->with('foo');
$app->expects($this->once())->method('addToParent')->with($this->equalTo($command))->will($this->returnValue($command));
$result = $app->add($command);
$this->assertEquals($command, $result);
}
public function testLaravelNotSetOnSymfonyCommands()
{
$app = $this->getMock('Illuminate\Console\Application', array('addToParent'));
$app->setLaravel('foo');
$command = m::mock('Symfony\Component\Console\Command\Command');
$command->shouldReceive('setLaravel')->never();
$app->expects($this->once())->method('addToParent')->with($this->equalTo($command))->will($this->returnValue($command));
$result = $app->add($command);
$this->assertEquals($command, $result);
}
public function testResolveAddsCommandViaApplicationResolution()
{
$app = $this->getMock('Illuminate\Console\Application', array('addToParent'));
$command = m::mock('Symfony\Component\Console\Command\Command');
$app->setLaravel(array('foo' => $command));
$app->expects($this->once())->method('addToParent')->with($this->equalTo($command))->will($this->returnValue($command));
$result = $app->resolve('foo');
$this->assertEquals($command, $result);
}
public function testResolveCommandsCallsResolveForAllCommandsItsGiven()
{
$app = m::mock('Illuminate\Console\Application[resolve]');
$app->shouldReceive('resolve')->twice()->with('foo');
$app->resolveCommands('foo', 'foo');
}
public function testResolveCommandsCallsResolveForAllCommandsItsGivenViaArray()
{
$app = m::mock('Illuminate\Console\Application[resolve]');
$app->shouldReceive('resolve')->twice()->with('foo');
$app->resolveCommands(array('foo', 'foo'));
}
}