64 - Making the Tests Identical

This commit is contained in:
Adam Wathan
2017-01-18 13:52:33 -05:00
parent 0d7720cdc0
commit 529e4d83bc
3 changed files with 29 additions and 2 deletions

View File

@@ -31,6 +31,13 @@ class FakePaymentGateway implements PaymentGateway
$this->charges[] = $amount;
}
public function newChargesDuring($callback)
{
$chargesFrom = $this->charges->count();
$callback($this);
return $this->charges->slice($chargesFrom)->values();
}
public function totalCharges()
{
return $this->charges->sum();

View File

@@ -7,4 +7,5 @@ interface PaymentGateway
public function charge($amount, $token);
public function getValidTestToken();
public function newChargesDuring($callback);
}