Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | public function testMake() |
||
19 | { |
||
20 | $server = m::mock(AuthorizationServer::class)->makePartial(); |
||
21 | $server->shouldReceive('respondToAccessTokenRequest')->andReturn($response = m::mock()); |
||
22 | $response->shouldReceive('getBody->__toString')->andReturn(json_encode([ |
||
23 | 'access_token' => 'foo.john.doe', |
||
24 | ])); |
||
25 | |||
26 | $client = new Client(); |
||
27 | |||
28 | $factory = m::mock(TokenFactory::class, [$server, $client]) |
||
29 | ->makePartial()->shouldAllowMockingProtectedMethods(); |
||
30 | $factory->shouldReceive('findAccessToken')->andReturn(new Token()); |
||
31 | |||
32 | $token = $factory->make(1, 'token', ['scopes']); |
||
33 | $this->assertInstanceOf(Token::class, $token); |
||
34 | } |
||
36 |