예제 #1
0
 public function testQueryProfiler_PrepareBindExecute()
 {
     $var = 1234;
     $stmt = $this->_adapter->prepare("SELECT * FROM foo WHERE bar = ?");
     $stmt->bindParam(1, $var);
     $qp = $this->_adapter->getProfiler()->getLastQueryProfile();
     /* @var $qp Zend\Db\Profiler\Query */
     $this->assertEquals(array(1 => 1234), $qp->getQueryParams());
     $this->assertEquals("SELECT * FROM foo WHERE bar = ?", $qp->getQuery());
 }
예제 #2
0
 /**
  * @group ZF-7936
  */
 public function testTruncateAppliedToTablesInReverseOrder()
 {
     $testAdapter = new \Zend\Test\DbAdapter();
     $connection = new Db\Connection($testAdapter, "schema");
     $dataSet = new \PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet(__DIR__ . "/_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());
 }