/** * test inserting a Sport, editing it, and updating it */ public function testUpdateValidSport() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("sport"); // create a new Sport and insert to into mySQL $sport = new Sport(null, $this->sport->getSportId(), $this->VALID_SPORT); $sport->insert($this->getPDO()); // edit the Sport and update it in mySQL $sport->setSport($this->VALID_SPORT); $sport->update($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoSport = Sport::getSportBySportId($this->getPDO(), $sport->getSportId()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("sport")); $this->assertEquals($pdoSport->getSportId(), $this->sport->getSportId()); }