/** * test inserting a Statistic, editing it, and updating it */ public function testUpdateValidStatistic() { // 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()); // edit the Statistic and update it in mySQL $statistic->setStatistic($this->VALID_STATISTIC); $statistic->update($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()); }