예제 #1
0
 public function testResourceDbShouldContainTheOwnerCompany()
 {
     $request = $this->getRequest();
     $request->setMethod('GET')->setGet(array('company' => 'Secogal'));
     $this->dispatch('/user/add');
     $adapter = new Zend_Test_DbAdapter();
     $resource = $adapter->query("SELECT * FROM company WHERE name ='{$request->company}'");
     //TODO "secogal must config in the config.ini
     $this->assertCount($resource, "0");
     $this->assertRedirectTo('/resource/error');
 }
예제 #2
0
 /**
  * @group ZF-7936
  */
 public function testTruncateAppliedToTablesInReverseOrder()
 {
     $testAdapter = new Zend_Test_DbAdapter();
     $connection = new Zend_Test_PHPUnit_Db_Connection($testAdapter, "schema");
     $dataSet = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(dirname(__FILE__) . "/_files/truncateFixture.xml");
     $this->operation->execute($connection, $dataSet);
     $profiler = $testAdapter->getProfiler();
     $queries = $profiler->getQueryProfiles();
     $this->assertEquals(2, count($queries));
     $this->assertContains('bar', $queries[0]->getQuery());
     $this->assertContains('foo', $queries[1]->getQuery());
 }
예제 #3
0
 public function testQueryTableWithoutRows()
 {
     $statementMock = new Zend_Test_DbStatement();
     $adapterMock = new Zend_Test_DbAdapter();
     $adapterMock->appendStatementToStack($statementMock);
     $this->decorateConnectionGetConnectionWith($adapterMock);
     $queryTable = new Zend_Test_PHPUnit_Db_DataSet_QueryTable("foo", null, $this->connectionMock);
     $metadata = $queryTable->getTableMetaData();
     $this->assertType('PHPUnit_Extensions_Database_DataSet_ITableMetaData', $metadata);
     $this->assertEquals(array(), $metadata->getColumns());
     $this->assertEquals(array(), $metadata->getPrimaryKeys());
     $this->assertEquals("foo", $metadata->getTableName());
 }
예제 #4
0
 public function testGetSetQuoteIdentifierSymbol()
 {
     $this->assertEquals('', $this->_adapter->getQuoteIdentifierSymbol());
     $this->_adapter->setQuoteIdentifierSymbol('`');
     $this->assertEquals('`', $this->_adapter->getQuoteIdentifierSymbol());
 }