Allow custom API keys to be created

This commit is contained in:
Alejandro Celaya
2023-09-19 09:10:17 +02:00
parent 49bd230474
commit 65a0a90a51
16 changed files with 93 additions and 94 deletions

View File

@@ -43,7 +43,7 @@ class ApiKeyFixture extends AbstractFixture implements DependentFixtureInterface
private function buildApiKey(string $key, bool $enabled, ?Chronos $expiresAt = null): ApiKey
{
$apiKey = $expiresAt !== null ? ApiKey::fromMeta(ApiKeyMeta::withExpirationDate($expiresAt)) : ApiKey::create();
$apiKey = ApiKey::fromMeta(ApiKeyMeta::fromParams(expirationDate: $expiresAt));
$ref = new ReflectionObject($apiKey);
$keyProp = $ref->getProperty('key');
$keyProp->setAccessible(true);