Exemplo n.º 1
0
 /**
  * @covers Zend\Db\Sql\Update::prepareStatement
  */
 public function testPrepareStatement()
 {
     $mockDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $mockDriver->expects($this->any())->method('getPrepareType')->will($this->returnValue('positional'));
     $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?'));
     $mockAdapter = $this->getMock('Zend\\Db\\Adapter\\Adapter', null, array($mockDriver));
     $mockStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $pContainer = new \Zend\Db\Adapter\ParameterContainer(array());
     $mockStatement->expects($this->any())->method('getParameterContainer')->will($this->returnValue($pContainer));
     $mockStatement->expects($this->at(1))->method('setSql')->with($this->equalTo('UPDATE "foo" SET "bar" = ?'));
     $mockStatement->expects($this->at(4))->method('setSql')->with($this->equalTo(' WHERE x = y'));
     $this->update->table('foo')->set(array('bar' => 'baz'))->where('x = y');
     $this->update->prepareStatement($mockAdapter, $mockStatement);
 }