コード例 #1
0
 /**
  * test creating a TeamStatistic and then deleting it
  **/
 public function testDeleteValidTeamStatistic()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("teamStatistic");
     // create a new Player Statistic and insert to into mySQL
     $teamStatistic = new TeamStatistic($this->game->getGameId(), $this->team->getTeamId(), $this->statistic->getStatisticId(), $this->VALID_TEAMSTATISTICVALUE);
     $teamStatistic->insert($this->getPDO());
     // Delete the Team from mySQL
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("teamStatistic"));
     $teamStatistic->delete($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoTeamStatistic = TeamStatistic::getTeamStatisticByTeamStatisticGameIdAndTeamStatisticTeamIdAndTeamStatisticStatisticId($this->getPDO(), $this->game->getGameId(), $this->team->getTeamId(), $this->statistic->getStatisticId());
     $this->assertNull($pdoTeamStatistic);
     $this->assertEquals($numRows, $this->getConnection()->getRowCount("teamStatistic"));
 }