mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-12 23:52:37 +00:00
92 - Dealing with Out of Sync Mocks
This commit is contained in:
@@ -27,7 +27,7 @@ class Ticket extends Model
|
|||||||
|
|
||||||
public function claimFor($order)
|
public function claimFor($order)
|
||||||
{
|
{
|
||||||
$this->code = TicketCode::generate();
|
$this->code = TicketCode::generateFor($this);
|
||||||
$order->tickets()->save($this);
|
$order->tickets()->save($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
"mockery/mockery": "0.9.*",
|
"mockery/mockery": "1.0.0-alpha1",
|
||||||
"phpunit/phpunit": "~5.0",
|
"phpunit/phpunit": "~5.0",
|
||||||
"symfony/css-selector": "3.1.*",
|
"symfony/css-selector": "3.1.*",
|
||||||
"symfony/dom-crawler": "3.1.*",
|
"symfony/dom-crawler": "3.1.*",
|
||||||
|
|||||||
398
composer.lock
generated
398
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,12 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
*/
|
*/
|
||||||
protected $baseUrl = 'http://localhost';
|
protected $baseUrl = 'http://localhost';
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the application.
|
* Creates the application.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class TicketTest extends TestCase
|
|||||||
{
|
{
|
||||||
$order = factory(Order::class)->create();
|
$order = factory(Order::class)->create();
|
||||||
$ticket = factory(Ticket::class)->create(['code' => null]);
|
$ticket = factory(Ticket::class)->create(['code' => null]);
|
||||||
TicketCode::shouldReceive('generate')->andReturn('TICKETCODE1');
|
TicketCode::shouldReceive('generateFor')->with($ticket)->andReturn('TICKETCODE1');
|
||||||
|
|
||||||
$ticket->claimFor($order);
|
$ticket->claimFor($order);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user