/** * Connect to the bdd * * @return Connection */ private function getConnection() { if ($this->connection !== null) { return $this->connection; } $this->mockGenerator->shuntParentClassCalls(); $this->mockGenerator->orphanize('__construct'); $this->connection = new \mock\Doctrine\DBAL\Connection(); $this->connection->getMockController()->connect = function () { }; $this->connection->getMockController()->quote = function ($input) { return '"' . addslashes($input) . '"'; }; $this->mockGenerator->unshuntParentClassCalls(); return $this->connection; }