/** * test inserting a sport, editing it, and then 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 update it in the db $sport = new Sport(null, $this->VALID_SPORTLEAGUE, $this->VALID_SPORTNAME); $sport->insert($this->getPDO()); // var_dump($sport); // edit the sport and update it in mysql $sport->setSportLeague($this->VALID_SPORTLEAGUE2); $sport->setSportName($this->VALID_SPORTNAME2); $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()); $this->assertEquals($pdoSport->getSportLeague(), $this->VALID_SPORTLEAGUE2); $this->assertEquals($pdoSport->getSportName(), $this->VALID_SPORTNAME2); }