shouldReceive('create')->once()->with('create_foo', BASE_PATH . DIRECTORY_SEPARATOR . 'migrations', 'foo', true)->andReturn(''); $this->runCommand($command, ['name' => 'create_foo']); } public function testBasicCreateGivesCreatorProperArgumentsWhenNameIsStudlyCase() { $command = new GenMigrateCommand( $creator = Mockery::mock(MigrationCreator::class) ); $creator->shouldReceive('create')->once()->with('create_foo', BASE_PATH . DIRECTORY_SEPARATOR . 'migrations', 'foo', true)->andReturn(''); $this->runCommand($command, ['name' => 'CreateFoo']); } public function testBasicCreateGivesCreatorProperArgumentsWhenTableIsSet() { $command = new GenMigrateCommand( $creator = Mockery::mock(MigrationCreator::class) ); $creator->shouldReceive('create')->once()->with('create_foo', BASE_PATH . DIRECTORY_SEPARATOR . 'migrations', 'users', true)->andReturn(''); $this->runCommand($command, ['name' => 'create_foo', '--create' => 'users']); } public function testBasicCreateGivesCreatorProperArgumentsWhenCreateTablePatternIsFound() { $command = new GenMigrateCommand( $creator = Mockery::mock(MigrationCreator::class) ); $creator->shouldReceive('create')->once()->with('create_users_table', BASE_PATH . DIRECTORY_SEPARATOR . 'migrations', 'users', true)->andReturn(''); $this->runCommand($command, ['name' => 'create_users_table']); } public function testCanSpecifyPathToCreateMigrationsIn() { $command = new GenMigrateCommand( $creator = Mockery::mock(MigrationCreator::class) ); $creator->shouldReceive('create')->once()->with('create_foo', BASE_PATH . '/vendor/hyperf/migrations', 'users', true)->andReturn(''); $this->runCommand($command, ['name' => 'create_foo', '--path' => 'vendor/hyperf/migrations', '--create' => 'users']); } protected function runCommand($command, $input = []) { return $command->run(new ArrayInput($input), new NullOutput()); } }