1 | <?php |
||
2 | |||
3 | namespace Earnould\LaravelVeloApi; |
||
4 | |||
5 | use Illuminate\Support\ServiceProvider; |
||
6 | use Earnould\LaravelVeloApi\Tests\Mocks\VeloClientMock; |
||
7 | |||
8 | class VeloServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | 15 | public function boot() |
|
11 | { |
||
12 | 15 | $this->publishes([ |
|
13 | 15 | __DIR__.'/../config/laravel-velo-api.php' => config_path('laravel-velo-api.php'), |
|
14 | 15 | ], 'config'); |
|
15 | 15 | } |
|
16 | |||
17 | /** |
||
18 | * Register the service provider. |
||
19 | */ |
||
20 | 15 | public function register() |
|
21 | { |
||
22 | 15 | $this->mergeConfigFrom(__DIR__.'/../config/laravel-velo-api.php', 'laravel-velo-api'); |
|
23 | |||
24 | 15 | $this->app->bind(VeloStations::class); |
|
25 | |||
26 | 15 | if (app()->environment('testing')) { |
|
0 ignored issues
–
show
introduced
by
![]() |
|||
27 | $this->app->bind('velo-stations', function () { |
||
28 | 7 | return new VeloStations(new VeloClientMock()); |
|
29 | 15 | }); |
|
30 | } else { |
||
31 | $this->app->bind('velo-stations', function () { |
||
32 | return new VeloStations(new VeloClient()); |
||
33 | }); |
||
34 | } |
||
35 | 15 | } |
|
36 | } |
||
37 |