Skip to content

Instantly share code, notes, and snippets.

@ipalaus
Created November 4, 2013 16:51
Show Gist options
  • Save ipalaus/7305578 to your computer and use it in GitHub Desktop.
Save ipalaus/7305578 to your computer and use it in GitHub Desktop.
@@ -15,7 +15,11 @@ class DatabaseSeederTest extends PHPUnit_Framework_TestCase {
{
$seeder = new Seeder;
$seeder->setContainer($container = m::mock('Illuminate\Container\Container'));
- $seeder->setCommand($command = m::mock('Illuminate\Console\Command'));
+ $output = m::mock('Symfony\Component\Console\Output\OutputInterface');
+ $output->shouldReceive('writeln')->once()->andReturn('foo');
+ $command = m::mock('Illuminate\Console\Command');
+ $command->shouldReceive('getOutput')->once()->andReturn($output);
+ $seeder->setCommand($command);
$container->shouldReceive('make')->once()->with('ClassName')->andReturn($child = m::mock('StdClass'));
$child->shouldReceive('setContainer')->once()->with($container)->andReturn($child);
$child->shouldReceive('setCommand')->once()->with($command)->andReturn($child);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment