Ejemplo n.º 1
0
 /**
  * test inserting a valid Sport and regrabbing it from mySQL
  **/
 public function testGetValidSportBySportId()
 {
     // 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());
     // 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());
 }