|
4 | 4 |
|
5 | 5 | use Illuminate\Config\Repository; |
6 | 6 | use MarkWalet\Packagist\Facades\Packagist; |
| 7 | +use MarkWalet\Packagist\PackagistServiceProvider; |
7 | 8 | use Spatie\Packagist\PackagistClient; |
8 | 9 | use Spatie\Packagist\PackagistUrlGenerator; |
9 | 10 |
|
10 | 11 | class PackagistServiceProviderTest extends LaravelTestCase |
11 | 12 | { |
12 | 13 | /** @test */ |
13 | | - public function it_binds_a_packagist_manager_to_the_application() |
| 14 | + public function it_binds_a_packagist_client_to_the_application() |
14 | 15 | { |
15 | 16 | $bindings = $this->app->getBindings(); |
16 | | - |
17 | 17 | $this->assertArrayHasKey(PackagistClient::class, $bindings); |
| 18 | + |
| 19 | + $result = $this->app->make(PackagistClient::class); |
| 20 | + $this->assertInstanceOf(PackagistClient::class, $result); |
| 21 | + } |
| 22 | + |
| 23 | + /** @test */ |
| 24 | + public function it_binds_a_url_generator_to_the_application() |
| 25 | + { |
| 26 | + $bindings = $this->app->getBindings(); |
| 27 | + $this->assertArrayHasKey(PackagistUrlGenerator::class, $bindings); |
| 28 | + |
| 29 | + $result = $this->app->make(PackagistUrlGenerator::class); |
| 30 | + $this->assertInstanceOf(PackagistUrlGenerator::class, $result); |
| 31 | + } |
| 32 | + |
| 33 | + /** @test */ |
| 34 | + public function the_service_provider_only_loads_when_one_of_the_bound_classes_should_be_injected() |
| 35 | + { |
| 36 | + $provider = new PackagistServiceProvider($this->app); |
| 37 | + |
| 38 | + $result = $provider->provides(); |
| 39 | + |
| 40 | + $this->assertSame([ |
| 41 | + PackagistClient::class, |
| 42 | + PackagistUrlGenerator::class, |
| 43 | + ], $result); |
18 | 44 | } |
19 | 45 |
|
20 | 46 | /** @test */ |
@@ -61,7 +87,7 @@ public function it_can_override_the_url_configuration() |
61 | 87 | $config = $this->app['config']; |
62 | 88 | $config->set('services.packagist', [ |
63 | 89 | 'base_url' => 'https://markwalet.me', |
64 | | - 'repo_url' => 'https://github.com' |
| 90 | + 'repo_url' => 'https://github.com', |
65 | 91 | ]); |
66 | 92 | /** @var PackagistUrlGenerator $generator */ |
67 | 93 | $generator = $this->app->make(PackagistUrlGenerator::class); |
|
0 commit comments