Exemplo n.º 1
0
 /**
  * Get a schema instance with a mocked driver/pdo instances
  *
  * @return MysqlSchema
  */
 protected function _getMockedDriver()
 {
     $driver = new \Cake\Database\Driver\Mysql();
     $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;
 }
Exemplo n.º 2
0
 /**
  * Get a schema instance with a mocked driver/pdo instances
  *
  * @return MysqlSchema
  */
 protected function _getMockedDriver()
 {
     $driver = new \Cake\Database\Driver\Mysql();
     $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;
 }