mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-20 07:55:09 +00:00
93 - Wiring It All Together
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\TicketCodeGenerator;
|
||||||
use App\Billing\PaymentGateway;
|
use App\Billing\PaymentGateway;
|
||||||
|
use App\HashidsTicketCodeGenerator;
|
||||||
use App\Billing\StripePaymentGateway;
|
use App\Billing\StripePaymentGateway;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use App\OrderConfirmationNumberGenerator;
|
use App\OrderConfirmationNumberGenerator;
|
||||||
@@ -31,7 +33,12 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
return new StripePaymentGateway(config('services.stripe.secret'));
|
return new StripePaymentGateway(config('services.stripe.secret'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->app->bind(HashidsTicketCodeGenerator::class, function () {
|
||||||
|
return new HashidsTicketCodeGenerator(config('app.ticket_code_salt'));
|
||||||
|
});
|
||||||
|
|
||||||
$this->app->bind(PaymentGateway::class, StripePaymentGateway::class);
|
$this->app->bind(PaymentGateway::class, StripePaymentGateway::class);
|
||||||
$this->app->bind(OrderConfirmationNumberGenerator::class, RandomOrderConfirmationNumberGenerator::class);
|
$this->app->bind(OrderConfirmationNumberGenerator::class, RandomOrderConfirmationNumberGenerator::class);
|
||||||
|
$this->app->bind(TicketCodeGenerator::class, HashidsTicketCodeGenerator::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,4 +228,5 @@ return [
|
|||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'ticket_code_salt' => env('TICKET_CODE_SALT'),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Concert;
|
use App\Concert;
|
||||||
|
use App\Facades\TicketCode;
|
||||||
use App\Billing\PaymentGateway;
|
use App\Billing\PaymentGateway;
|
||||||
use App\Billing\FakePaymentGateway;
|
use App\Billing\FakePaymentGateway;
|
||||||
use App\Facades\OrderConfirmationNumber;
|
use App\Facades\OrderConfirmationNumber;
|
||||||
@@ -54,6 +55,7 @@ class PurchaseTicketsTest extends TestCase
|
|||||||
$this->disableExceptionHandling();
|
$this->disableExceptionHandling();
|
||||||
|
|
||||||
OrderConfirmationNumber::shouldReceive('generate')->andReturn('ORDERCONFIRMATION1234');
|
OrderConfirmationNumber::shouldReceive('generate')->andReturn('ORDERCONFIRMATION1234');
|
||||||
|
TicketCode::shouldReceive('generateFor')->andReturn('TICKETCODE1', 'TICKETCODE2', 'TICKETCODE3');
|
||||||
|
|
||||||
$concert = factory(Concert::class)->states('published')->create(['ticket_price' => 3250])->addTickets(3);
|
$concert = factory(Concert::class)->states('published')->create(['ticket_price' => 3250])->addTickets(3);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user