forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseMigrationResetCommandTest.php
More file actions
executable file
·41 lines (29 loc) · 1.24 KB
/
DatabaseMigrationResetCommandTest.php
File metadata and controls
executable file
·41 lines (29 loc) · 1.24 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
<?php
use Mockery as m;
use Illuminate\Database\Console\Migrations\ResetCommand;
class DatabaseMigrationResetCommandTest extends PHPUnit_Framework_TestCase {
public function tearDown()
{
m::close();
}
public function testResetCommandCallsMigratorWithProperArguments()
{
$command = new ResetCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'));
$migrator->shouldReceive('setConnection')->once()->with(null);
$migrator->shouldReceive('rollback')->twice()->with(false)->andReturn(true, false);
$migrator->shouldReceive('getNotes')->andReturn(array());
$this->runCommand($command);
}
public function testResetCommandCanBePretended()
{
$command = new ResetCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'));
$migrator->shouldReceive('setConnection')->once()->with('foo');
$migrator->shouldReceive('rollback')->twice()->with(true)->andReturn(true, false);
$migrator->shouldReceive('getNotes')->andReturn(array());
$this->runCommand($command, array('--pretend' => true, '--database' => 'foo'));
}
protected function runCommand($command, $input = array())
{
return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput);
}
}