Пример #1
0
 /**
  * test inserting a valid Statistic and regrabbing it from mySQL
  **/
 public function testGetValidStatisticByStatisticId()
 {
     // 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());
     // 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());
 }