forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCacheTableCommandTest.php
More file actions
47 lines (40 loc) · 1.44 KB
/
CacheTableCommandTest.php
File metadata and controls
47 lines (40 loc) · 1.44 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
<?php
use Mockery as m;
use Illuminate\Foundation\Application;
use Illuminate\Cache\Console\CacheTableCommand;
class CacheTableCommandTest extends PHPUnit_Framework_TestCase
{
public function tearDown()
{
m::close();
}
public function testCreateMakesMigration()
{
$command = new CacheTableCommandTestStub(
$files = m::mock('Illuminate\Filesystem\Filesystem'),
$composer = m::mock('Illuminate\Foundation\Composer')
);
$creator = m::mock('Illuminate\Database\Migrations\MigrationCreator')->shouldIgnoreMissing();
$app = new Application();
$app->useDatabasePath(__DIR__);
$app['migration.creator'] = $creator;
$command->setLaravel($app);
$path = __DIR__.'/migrations';
$creator->shouldReceive('create')->once()->with('create_cache_table', $path)->andReturn($path);
$files->shouldReceive('get')->once()->andReturn('foo');
$files->shouldReceive('put')->once()->with($path, 'foo');
$composer->shouldReceive('dumpAutoloads')->once();
$this->runCommand($command);
}
protected function runCommand($command, $input = [])
{
return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput);
}
}
class CacheTableCommandTestStub extends CacheTableCommand
{
public function call($command, array $arguments = [])
{
//
}
}