fix for unit-testing on null user (to dig : why ?...)

This commit is contained in:
Jean-Yves Gaulier
2020-02-08 09:58:57 +01:00
parent 419440f5c2
commit 83484e3bd0

View File

@@ -78,12 +78,12 @@ class TokenManipulator implements ManipulatorInterface
$now = (new \DateTime())->format('Y-m-d H:i:s'); $now = (new \DateTime())->format('Y-m-d H:i:s');
$stmtParms = [ $stmtParms = [
':value' => null, ':value' => null,
':user_id' => $user->getId(), ':user_id' => $user ? $user->getId() : null,
':type' => $type, ':type' => $type,
':data' => $data, ':data' => $data,
':created' => $now, ':created' => $now,
':updated' => $now, ':updated' => $now,
':expiration' => ($expiration === null ? null : $expiration->format('Y-m-d H:i:s')) ':expiration' => $expiration ? $expiration->format('Y-m-d H:i:s') : null
]; ];
for($try=0; $try<1024; $try++) { for($try=0; $try<1024; $try++) {
$stmtParms['value'] = $this->random->generateString(32, self::LETTERS_AND_NUMBERS); $stmtParms['value'] = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);