6.7 - Replicating the Failure at the Unit Level

This commit is contained in:
Adam Wathan
2016-11-20 17:47:25 -05:00
parent 91672fef0b
commit 2b21f07aa2
3 changed files with 12 additions and 7 deletions

View File

@@ -105,6 +105,8 @@ class PurchaseTicketsTest extends TestCase
/** @test */
function cannot_purchase_tickets_another_customer_is_already_trying_to_purchase()
{
$this->disableExceptionHandling();
$concert = factory(Concert::class)->states('published')->create([
'ticket_price' => 1200
])->addTickets(3);

View File

@@ -35,15 +35,16 @@ class FakePaymentGatewayTest extends TestCase
function running_a_hook_before_the_first_charge()
{
$paymentGateway = new FakePaymentGateway;
$callbackRan = false;
$timesCallbackRan = 0;
$paymentGateway->beforeFirstCharge(function ($paymentGateway) use (&$callbackRan) {
$callbackRan = true;
$this->assertEquals(0, $paymentGateway->totalCharges());
$paymentGateway->beforeFirstCharge(function ($paymentGateway) use (&$timesCallbackRan) {
$timesCallbackRan++;
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken());
$this->assertEquals(2500, $paymentGateway->totalCharges());
});
$paymentGateway->charge(2500, $paymentGateway->getValidTestToken());
$this->assertTrue($callbackRan);
$this->assertEquals(2500, $paymentGateway->totalCharges());
$this->assertEquals(1, $timesCallbackRan);
$this->assertEquals(5000, $paymentGateway->totalCharges());
}
}