diff --git a/DbUser.php b/DbUser.php index ed0651f..b5e139b 100644 --- a/DbUser.php +++ b/DbUser.php @@ -250,7 +250,7 @@ public function dropUserQuery($username) */ public function userExist($username) { - return $this->connection->fetchColumn($this->userExistQuery($username)); + return $this->connection->query($this->userExistQuery($username))->fetchColumn(); } /** diff --git a/Tests/Units/DbUser.php b/Tests/Units/DbUser.php index 7165051..9462c0d 100644 --- a/Tests/Units/DbUser.php +++ b/Tests/Units/DbUser.php @@ -8,6 +8,7 @@ namespace Shinbuntu\DbUser\Tests\Units; use atoum; +use mock\Doctrine\DBAL\Driver\PDOStatement; use mock\Doctrine\DBAL\Connection; use Shinbuntu\DbUser\DbUser as testedClass; @@ -38,6 +39,9 @@ private function getConnection() $this->connection->getMockController()->quote = function ($input) { return '"'.addslashes($input).'"'; }; + $this->connection->getMockController()->query = function () { + return new PDOStatement(); + }; $this->mockGenerator->unshuntParentClassCalls();