| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function testGetServiceByUrl() |
||
| 19 | { |
||
| 20 | $serviceHost = Mockery::mock(ServiceHost::class); |
||
| 21 | $serviceHost->shouldReceive('where->first')->andReturn(null); |
||
| 22 | app()->instance(ServiceHost::class, $serviceHost); |
||
| 23 | $this->assertNull(app()->make(ServiceRepository::class)->getServiceByUrl('http://www.baidu.com')); |
||
| 24 | |||
| 25 | $service = Mockery::mock(Service::class); |
||
| 26 | $serviceHost = Mockery::mock(ServiceHost::class); |
||
| 27 | $serviceHost->shouldReceive('where->first')->andReturn((object) ['service' => $service]); |
||
| 28 | app()->instance(ServiceHost::class, $serviceHost); |
||
| 29 | $this->assertEquals($service, app()->make(ServiceRepository::class)->getServiceByUrl('http://www.baidu.com')); |
||
| 30 | } |
||
| 31 | |||
| 49 |