I want to write test case using phpunit for following model function. I'm beginner to unit testing , Kindly please advice me.
public function checkUserEmailExist($email)
{
$query = \registry::getDBHandler()->prepare("SELECT email FROM users WHERE email = :EMAIL");
$query->bindValue(":EMAIL", $email);
try{
$query->execute();
$result = ($query->fetchColumn());
} catch(PDOException $e) {
\debug::error('MySQL errno ' . $e->getCode() . ': "' . $e->getMessage() . '" when executing: ' . $query->queryString);
}
return $result;
}
Aucun commentaire:
Enregistrer un commentaire