function its_user_of_email(SqlManager $pdo, \PDOStatement $statement, UserEmail $email)
 {
     $email->getValue()->shouldBeCalled()->willReturn('*****@*****.**');
     $pdo->execute(sprintf('SELECT * FROM %s WHERE email = :email', SqlUserRepository::TABLE_NAME), ['email' => '*****@*****.**'])->shouldBeCalled()->willReturn($statement);
     $statement->fetch(\PDO::FETCH_ASSOC)->shouldBeCalled()->willReturn(['id' => 'theid', 'email' => '*****@*****.**', 'password' => 'password']);
     $this->userOfEmail($email)->shouldReturnAnInstanceOf('Domain\\Model\\User\\User');
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function userOfEmail(UserEmail $anEmail)
 {
     $statement = $this->pdo->execute(sprintf('SELECT * FROM %s WHERE email = :email', self::TABLE_NAME), ['email' => $anEmail->getValue()]);
     if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
         return $this->buildUser($row);
     }
     return;
 }