예제 #1
0
 /**
  * test deleting a Statistic that does not exist
  */
 public function testDeleteValidStatistic()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("statistic");
     // create a new Statistic and insert to into mySQL
     $statistic = new Statistic(null, $this->statistic->getStatisticId(), $this->VALID_STATISTIC);
     $statistic->insert($this->getPDO());
     // Delete this Statistic from mySQL
     $statistic->assertEquals($numRows + 1, $this->getConnection()->getRowCount("statistic"));
     $statistic->delete($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoStatistic = Statistic::getStatisticByStatisticId($this->getPDO(), $statistic->getStatisticId());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("statistic"));
     $this->assertEquals($pdoStatistic->getStatisticId(), $this->statistic->getStatisticId());
 }