| @@ 19-35 (lines=17) @@ | ||
| 16 | class TokenTest extends AbstractTest |
|
| 17 | { |
|
| 18 | ||
| 19 | public function testSetIdentifier() |
|
| 20 | { |
|
| 21 | /** @var Clients $tokens */ |
|
| 22 | $tokens = \Mockery::mock(Tokens::class)->makePartial(); |
|
| 23 | $tokens->shouldReceive('getFields')->andReturn(['id', 'identifier', 'secret']); |
|
| 24 | $tokens->shouldReceive('getPrimaryKey')->andReturn('id'); |
|
| 25 | $tokens->shouldReceive('getModel')->andReturn(Token::class); |
|
| 26 | ||
| 27 | $token = $tokens->getNew(); |
|
| 28 | self::assertNull($token->getIdentifier()); |
|
| 29 | ||
| 30 | $token->setIdentifier(99); |
|
| 31 | self::assertSame(99, $token->getIdentifier()); |
|
| 32 | ||
| 33 | $data = $tokens->getQueryModelData($token); |
|
| 34 | self::assertArrayHasKey('identifier', $data); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testGetClient() |
|
| 38 | { |
|
| @@ 26-40 (lines=15) @@ | ||
| 23 | self::assertSame('9999', $client->getIdentifier()); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function testSetIdentifier() |
|
| 27 | { |
|
| 28 | /** @var Clients $clients */ |
|
| 29 | $clients = \Mockery::mock(Clients::class)->makePartial(); |
|
| 30 | $clients->shouldReceive('getFields')->andReturn(['id', 'identifier', 'secret']); |
|
| 31 | $clients->shouldReceive('getPrimaryKey')->andReturn('id'); |
|
| 32 | $clients->shouldReceive('getModel')->andReturn(Client::class); |
|
| 33 | ||
| 34 | $client = $clients->getNew(); |
|
| 35 | $identifier = $client->getIdentifier(); |
|
| 36 | self::assertGreaterThan(30, strlen($identifier)); |
|
| 37 | ||
| 38 | $data = $clients->getQueryModelData($client); |
|
| 39 | self::assertArrayHasKey('identifier', $data); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||