-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceProviderTest.php
More file actions
41 lines (31 loc) · 1.49 KB
/
ServiceProviderTest.php
File metadata and controls
41 lines (31 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use Bernskiold\LaravelTalentLms\Api\TalentLms;
use Bernskiold\LaravelTalentLms\Api\TalentLmsApiClient;
describe('LaravelTalentLmsServiceProvider', function () {
it('registers the TalentLmsApiClient binding', function () {
$client = app(TalentLmsApiClient::class);
expect($client)->toBeInstanceOf(TalentLmsApiClient::class);
});
it('registers the laravel-talentlms alias', function () {
$talentLms = app('laravel-talentlms');
expect($talentLms)->toBeInstanceOf(TalentLms::class);
});
it('publishes the config file', function () {
$this->artisan('vendor:publish', [
'--provider' => 'Bernskiold\LaravelTalentLms\LaravelTalentLmsServiceProvider',
'--tag' => 'config',
]);
expect(config('talentlms'))->toBeArray();
expect(config('talentlms.api'))->toHaveKeys(['api_key', 'domain', 'version']);
});
it('loads the config file', function () {
expect(config('talentlms.api.api_key'))->toBe('test-api-key');
expect(config('talentlms.api.domain'))->toBe('https://test.talentlms.com');
expect(config('talentlms.api.version'))->toBe('1');
});
it('registers the rate limiter', function () {
$limiter = app(\Illuminate\Cache\RateLimiting\Limit::class);
// Rate limiter is registered, we can check if the RateLimiter facade has a 'talentlms' limiter
expect(\Illuminate\Support\Facades\RateLimiter::limiter('talentlms'))->not->toBeNull();
});
});