/** * Get a schema instance with a mocked driver/pdo instances * * @return \Cake\Database\Driver */ protected function _getMockedDriver() { $driver = new \Cake\Database\Driver\Postgres(); $mock = $this->getMockBuilder('FakePdo')->setMethods(['quote'])->getMock(); $mock->expects($this->any())->method('quote')->will($this->returnCallback(function ($value) { return "'{$value}'"; })); $driver->connection($mock); return $driver; }
/** * Get a schema instance with a mocked driver/pdo instances * * @return Driver */ protected function _getMockedDriver() { $driver = new \Cake\Database\Driver\Postgres(); $mock = $this->getMock('FakePdo', ['quote', 'quoteIdentifier']); $mock->expects($this->any())->method('quote')->will($this->returnCallback(function ($value) { return '"' . $value . '"'; })); $mock->expects($this->any())->method('quoteIdentifier')->will($this->returnCallback(function ($value) { return '"' . $value . '"'; })); $driver->connection($mock); return $driver; }