|
4 | 4 | use Illuminate\Queue\Events\JobProcessed; |
5 | 5 | use Illuminate\Queue\Jobs\Job; |
6 | 6 | use Illuminate\Support\Facades\Http; |
| 7 | +use SlashEquip\LaravelSegment\Contracts\SegmentServiceContract; |
7 | 8 | use SlashEquip\LaravelSegment\Facades\Segment; |
8 | 9 | use SlashEquip\LaravelSegment\SegmentService; |
9 | 10 | use SlashEquip\LaravelSegment\Tests\Stubs\SegmentTestUser; |
10 | 11 |
|
11 | 12 | it('can be resolved from the container', function () { |
12 | | - $this->assertInstanceOf(SegmentService::class, app(SegmentService::class)); |
| 13 | + expect(app(SegmentServiceContract::class)) |
| 14 | + ->toBeInstanceOf(SegmentService::class); |
13 | 15 | }); |
14 | 16 |
|
15 | 17 | it('can track a user using the track method with global user and context', function () { |
|
103 | 105 |
|
104 | 106 | it('terminates the segment service on job processed', function () { |
105 | 107 | // Given we are spying on the service |
106 | | - $service = $this->spy(SegmentService::class); |
| 108 | + $service = test()->spy(SegmentServiceContract::class); |
107 | 109 |
|
108 | 110 | // When we fire the job processed event |
109 | 111 | event(new JobProcessed('default', Mockery::mock(Job::class))); |
|
115 | 117 |
|
116 | 118 | it('terminates the segment service on app terminate', function () { |
117 | 119 | // Given we are spying on the service |
118 | | - $service = $this->spy(SegmentService::class); |
| 120 | + $service = test()->spy(SegmentServiceContract::class); |
119 | 121 |
|
120 | 122 | // When we terminate the app |
121 | | - $this->app->terminate(); |
| 123 | + test()->app()->terminate(); |
122 | 124 |
|
123 | 125 | // Then we have called the terminate method |
124 | 126 | $service->shouldHaveReceived('terminate') |
|
0 commit comments