83 - Promoting Charges to Objects

This commit is contained in:
Adam Wathan
2017-03-17 12:19:35 -04:00
parent 442cc3f240
commit 6e983c593c
4 changed files with 50 additions and 8 deletions

View File

@@ -16,7 +16,18 @@ trait PaymentGatewayContractTests
});
$this->assertCount(1, $newCharges);
$this->assertEquals(2500, $newCharges->sum());
$this->assertEquals(2500, $newCharges->map->amount()->sum());
}
/** @test */
function can_get_details_about_a_successful_charge()
{
$paymentGateway = $this->getPaymentGateway();
$charge = $paymentGateway->charge(2500, $paymentGateway->getValidTestToken('0000000000004242'));
$this->assertEquals('4242', $charge->cardLastFour());
$this->assertEquals(2500, $charge->amount());
}
/** @test */
@@ -50,6 +61,6 @@ trait PaymentGatewayContractTests
});
$this->assertCount(2, $newCharges);
$this->assertEquals([5000, 4000], $newCharges->all());
$this->assertEquals([5000, 4000], $newCharges->map->amount()->all());
}
}