Skip to content

Instantly share code, notes, and snippets.

@crynobone
Created November 8, 2013 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crynobone/7366891 to your computer and use it in GitHub Desktop.
Save crynobone/7366891 to your computer and use it in GitHub Desktop.
<?php
class ExampleTest extends TestCase {
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
Artisan::call('migrate');
$this->seed();
}
/**
* Seed a given database connection.
*
* @param string $class
* @return void
*/
public function seed($class = 'DatabaseSeeder')
{
$command = $this->getMockBuilder('\Illuminate\Console\Command')
->disableOriginalConstructor()
->setMethods(array('getOutput', 'writeln'))
->getMock();
$command->expects($this->any())->method('getOutput')->will($this->returnValue($command));
$command->expects($this->any())->method('writeln')->will($this->returnValue(null));
$this->app[$class]->setCommand($command)->run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment