当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Test_DbStatement类代码示例

本文整理汇总了PHP中Zend_Test_DbStatement的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Test_DbStatement类的具体用法?PHP Zend_Test_DbStatement怎么用?PHP Zend_Test_DbStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Test_DbStatement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDataIsLoadedOnlyOnce

 public function testDataIsLoadedOnlyOnce()
 {
     $fixtureSql = "SELECT * FROM foo";
     $statementMock = new Zend_Test_DbStatement();
     $statementMock->append(array('foo' => 'bar'));
     $adapterMock = $this->getMock('Zend_Test_DbAdapter');
     $adapterMock->expects($this->once())->method('query')->with($fixtureSql)->will($this->returnValue($statementMock));
     $this->decorateConnectionGetConnectionWith($adapterMock);
     $queryTable = new Zend_Test_PHPUnit_Db_DataSet_QueryTable("foo", $fixtureSql, $this->connectionMock);
     $this->assertEquals(1, $queryTable->getRowCount());
     $this->assertEquals(1, $queryTable->getRowCount());
     $row = $queryTable->getRow(0);
     $this->assertEquals(array('foo' => 'bar'), $row);
 }
开发者ID:omusico,项目名称:logica,代码行数:14,代码来源:QueryTableTest.php

示例2: testIsInstalled

 public function testIsInstalled()
 {
     $installer = new Installer_Default($this->db);
     $this->assertFalse($installer->isInstalled());
     $this->dbAdapter->appendStatementToStack(Zend_Test_DbStatement::createSelectStatement(array('omeka_options')));
     $this->assertTrue($installer->isInstalled());
     $this->profilerHelper->assertDbQuery("SHOW TABLES LIKE 'omeka_options'");
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:8,代码来源:DefaultTest.php

示例3: testAppendStatementToStack

 public function testAppendStatementToStack()
 {
     $stmt1 = Zend_Test_DbStatement::createSelectStatement(array());
     $this->_adapter->appendStatementToStack($stmt1);
     $stmt2 = Zend_Test_DbStatement::createSelectStatement(array());
     $this->_adapter->appendStatementToStack($stmt2);
     $this->assertSame($stmt2, $this->_adapter->query("foo"));
     $this->assertSame($stmt1, $this->_adapter->query("foo"));
 }
开发者ID:nbcutech,项目名称:o3drupal,代码行数:9,代码来源:DbAdapterTest.php

示例4: testSetRecordUsingIntegerId

 public function testSetRecordUsingIntegerId()
 {
     $builder = new DummyRecordBuilder($this->db);
     $this->dbAdapter->appendStatementToStack(Zend_Test_DbStatement::createSelectStatement(array(array('id' => self::DUMMY_RECORD_ID, 'description' => 'foobar'))));
     $builder->setRecord(self::DUMMY_RECORD_ID);
     $record = $builder->getRecord();
     $this->assertThat($record, $this->isInstanceOf('DummyRecordBuilderRecord'));
     $this->assertTrue($record->exists());
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:9,代码来源:BuilderTest.php

示例5: testTotalItems

 public function testTotalItems()
 {
     $collectionId = 1;
     $this->dbAdapter = new Zend_Test_DbAdapter();
     $this->dbAdapter->appendLastInsertIdToStack($collectionId);
     $this->db = new Omeka_Db($this->dbAdapter);
     $this->collection = new Collection($this->db);
     $this->profilerHelper = new Omeka_Test_Helper_DbProfiler($this->db->getAdapter()->getProfiler(), $this);
     $this->dbAdapter->appendStatementToStack(Zend_Test_DbStatement::createSelectStatement(array(array(3))));
     $this->assertEquals(3, $this->collection->totalItems());
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:11,代码来源:CollectionTest.php

示例6: testFetchObject_ClassNotExists_ThrowsException

 public function testFetchObject_ClassNotExists_ThrowsException()
 {
     $this->setExpectedException("Zend_Db_Statement_Exception");
     $row = array("foo" => "bar", "bar" => "baz");
     $stmt = new Zend_Test_DbStatement();
     $stmt->append($row);
     $object = $stmt->fetchObject("anInvalidClassName");
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:8,代码来源:DbStatementTest.php

示例7: prepare

 /**
  * Prepare a statement and return a PDOStatement-like object.
  *
  * @param string|Zend_Db_Select $sql SQL query
  * @return Zend_Db_Statment|PDOStatement
  */
 public function prepare($sql)
 {
     $queryId = $this->getProfiler()->queryStart($sql);
     if (count($this->_statementStack)) {
         $stmt = array_pop($this->_statementStack);
     } else {
         $stmt = new Zend_Test_DbStatement();
     }
     if ($this->getProfiler()->getEnabled() == true) {
         $qp = $this->getProfiler()->getQueryProfile($queryId);
         $stmt->setQueryProfile($qp);
     }
     return $stmt;
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:20,代码来源:DbAdapter.php

示例8: _createRowCountStatement

 /**
  * Create a Row Count Statement
  *
  * @param  int $affectedRows
  * @return Zend_Test_DbStatement
  */
 protected static function _createRowCountStatement($affectedRows)
 {
     $stmt = new Zend_Test_DbStatement();
     $stmt->setRowCount($affectedRows);
     return $stmt;
 }
开发者ID:SerdarSanri,项目名称:laravel-zend-bundle,代码行数:12,代码来源:DbStatement.php


注:本文中的Zend_Test_DbStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。