| @@ 57-65 (lines=9) @@ | ||
| 54 | /** |
|
| 55 | * @test |
|
| 56 | */ |
|
| 57 | public function checkReturnsFalseWhenKeyIsInvalid() |
|
| 58 | { |
|
| 59 | $repo = $this->prophesize(EntityRepository::class); |
|
| 60 | $repo->findOneBy(['key' => '12345'])->willReturn(null) |
|
| 61 | ->shouldBeCalledTimes(1); |
|
| 62 | $this->em->getRepository(ApiKey::class)->willReturn($repo->reveal()); |
|
| 63 | ||
| 64 | $this->assertFalse($this->service->check('12345')); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @test |
|
| @@ 100-108 (lines=9) @@ | ||
| 97 | /** |
|
| 98 | * @test |
|
| 99 | */ |
|
| 100 | public function checkReturnsTrueWhenConditionsAreFavorable() |
|
| 101 | { |
|
| 102 | $repo = $this->prophesize(EntityRepository::class); |
|
| 103 | $repo->findOneBy(['key' => '12345'])->willReturn(new ApiKey()) |
|
| 104 | ->shouldBeCalledTimes(1); |
|
| 105 | $this->em->getRepository(ApiKey::class)->willReturn($repo->reveal()); |
|
| 106 | ||
| 107 | $this->assertTrue($this->service->check('12345')); |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * @test |
|