public function testCreateSelectStatementWithRows()
 {
     $rows = array("foo", "bar");
     $stmt = Zend_Test_DbStatement::createSelectStatement($rows);
     $this->assertTrue($stmt instanceof Zend_Test_DbStatement);
     $this->assertEquals($rows, $stmt->fetchAll());
 }
예제 #2
0
 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'");
 }
예제 #3
0
 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"));
 }
예제 #4
0
 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());
 }
예제 #5
0
 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());
 }