mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-01 11:47:22 +00:00
57 - Don't Mock What You Don't Own
This commit is contained in:
21
tests/unit/Billing/MockStripePaymentGatewayTest.php
Normal file
21
tests/unit/Billing/MockStripePaymentGatewayTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use App\Billing\Alternate\StripePaymentGateway;
|
||||
|
||||
class MockStripePaymentGatewayTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
function charges_with_a_valid_payment_token_are_successful()
|
||||
{
|
||||
$stripeClient = Mockery::spy(\Stripe\ApiClient::class);
|
||||
$paymentGateway = new StripePaymentGateway($stripeClient);
|
||||
|
||||
$paymentGateway->charge(2500, 'valid-token');
|
||||
|
||||
$stripeClient->shouldHaveReceived('createCharge')->with([
|
||||
'amount' => 2500,
|
||||
'source' => 'valid-token',
|
||||
'currency' => 'usd',
|
||||
])->once();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Billing\StripePaymentGateway;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class StripePaymentGatewayTest extends TestCase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user