Improved public API in ApiKey entity, reducing anemic model

This commit is contained in:
Alejandro Celaya
2018-10-28 15:24:41 +01:00
parent e046eddda9
commit 877b098b09
6 changed files with 23 additions and 46 deletions

View File

@@ -87,8 +87,7 @@ class ApiKeyServiceTest extends TestCase
*/
public function checkReturnsFalseWhenKeyIsExpired()
{
$key = new ApiKey();
$key->setExpirationDate(Chronos::now()->subDay());
$key = new ApiKey(Chronos::now()->subDay());
$repo = $this->prophesize(EntityRepository::class);
$repo->findOneBy(['key' => '12345'])->willReturn($key)
->shouldBeCalledTimes(1);