Skip to content

Instantly share code, notes, and snippets.

@flaviozantut
Forked from danharper/1-TestCase.php
Created July 10, 2013 13:57
Show Gist options
  • Save flaviozantut/5966495 to your computer and use it in GitHub Desktop.
Save flaviozantut/5966495 to your computer and use it in GitHub Desktop.
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
// ...
public function appMock($name)
{
$mock = Mockery::mock($name);
App::instance($name, $mock);
return $mock;
}
}
<?php
class JobsControllerTest extends TestCase
{
public function testSomething()
{
$this->appMock('JobRepositoryInterface')
->shouldReceive('all')->once()
->andReturn('lorem');
$this->call('GET', 'jobs');
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment