Skip to content

Commit

Permalink
Fix userExist with PDO
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-monnot committed Aug 31, 2016
1 parent 74b85f2 commit 284ee9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DbUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions Tests/Units/DbUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 284ee9f

Please sign in to comment.