forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoutingMakeControllerCommandTest.php
More file actions
executable file
·37 lines (26 loc) · 1.33 KB
/
RoutingMakeControllerCommandTest.php
File metadata and controls
executable file
·37 lines (26 loc) · 1.33 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
<?php
use Mockery as m;
class RoutingMakeControllerCommandTest extends PHPUnit_Framework_TestCase {
public function tearDown()
{
m::close();
}
public function testGeneratorIsCalledWithProperOptions()
{
$command = new Illuminate\Routing\Console\MakeControllerCommand($gen = m::mock('Illuminate\Routing\Generators\ControllerGenerator'), __DIR__);
$gen->shouldReceive('make')->once()->with('FooController', __DIR__, array('only' => array(), 'except' => array()));
$this->runCommand($command, array('name' => 'FooController'));
}
public function testGeneratorIsCalledWithProperOptionsForExceptAndOnly()
{
$command = new Illuminate\Routing\Console\MakeControllerCommand($gen = m::mock('Illuminate\Routing\Generators\ControllerGenerator'), __DIR__);
$gen->shouldReceive('make')->once()->with('FooController', __DIR__.'/foo/bar', array('only' => array('foo', 'bar'), 'except' => array('baz', 'boom')));
$command->setLaravel(array('path.base' => __DIR__.'/foo'));
$this->runCommand($command, array('name' => 'FooController', '--only' => 'foo,bar', '--except' => 'baz,boom', '--path' => 'bar'));
}
public function runCommand($command, $input = array(), $output = null)
{
$output = $output ?: new Symfony\Component\Console\Output\NullOutput;
return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), $output);
}
}