92 - Dealing with Out of Sync Mocks

This commit is contained in:
Adam Wathan
2017-04-01 14:00:59 -04:00
parent 084d1999a9
commit 6023eb3c8f
5 changed files with 218 additions and 192 deletions

View File

@@ -12,6 +12,12 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
*/
protected $baseUrl = 'http://localhost';
protected function setUp()
{
parent::setUp();
Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
}
/**
* Creates the application.
*

View File

@@ -40,7 +40,7 @@ class TicketTest extends TestCase
{
$order = factory(Order::class)->create();
$ticket = factory(Ticket::class)->create(['code' => null]);
TicketCode::shouldReceive('generate')->andReturn('TICKETCODE1');
TicketCode::shouldReceive('generateFor')->with($ticket)->andReturn('TICKETCODE1');
$ticket->claimFor($order);