Exemplo n.º 1
0
 /**
  * test inserting a Team, editing it, and then updating it
  **/
 public function testUpdateValidTeam()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("team");
     // Create a new team and insert into mySQL
     $team = new Team(null, $this->sport->getSportId(), $this->VALID_TEAMAPIID, $this->VALID_TEAMCITY, $this->VALID_TEAMNAME);
     $team->insert($this->getPDO());
     // edit the Team and update it in mySQL
     $team->setTEAMAPIID($this->VALID_TEAMAPIID2);
     $team->setTEAMCITY($this->VALID_TEAMCITY2);
     $team->setTEAMNAME($this->VALID_TEAMNAME2);
     $team->update($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoTeam = Team::getTeamByTeamId($this->getPDO(), $team->getTeamId());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("team"));
     $this->assertEquals($pdoTeam->getTeamSportId(), $this->sport->getSportId());
     $this->assertEquals($pdoTeam->getTeamApiId(), $this->VALID_TEAMAPIID2);
     $this->assertEquals($pdoTeam->getTeamCity(), $this->VALID_TEAMCITY2);
     $this->assertEquals($pdoTeam->getTeamName(), $this->VALID_TEAMNAME2);
     //$this->assertEquals($pdoTeam->getTeamSportId(), $this->VALID_TEAMSPORTID);
 }