Ejemplo n.º 1
0
 /**
  * test grabbing a Team by team name
  **/
 public function testGetValidTeamByTeamName()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("team");
     // create a new Team and insert to into mySQL
     $team = new Team(null, $this->sport->getSportId(), $this->VALID_TEAMAPIID, $this->VALID_TEAMCITY, $this->VALID_TEAMNAME);
     $team->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $results = Team::getTeamByTeamName($this->getPDO(), $team->getTeamName());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("team"));
     $this->assertCount(1, $results);
     $this->assertContainsOnlyInstancesOf("Edu\\Cnm\\Sprots\\Team", $results);
     // grab the result from the array and validate it
     $pdoTeam = $results[0];
     $this->assertEquals($pdoTeam->getTeamSportId(), $this->sport->getSportId());
     $this->assertEquals($pdoTeam->getTeamApiId(), $this->VALID_TEAMAPIID);
     $this->assertEquals($pdoTeam->getTeamCity(), $this->VALID_TEAMCITY);
     $this->assertEquals($pdoTeam->getTeamName(), $this->VALID_TEAMNAME);
     //$this->assertEquals($pdoTeam->getTeamSportId(), $this->VALID_TEAMSPORTID);
 }