예제 #1
0
 /**
  * test creating a player and then deleting it
  **/
 public function testDeleteValidPlayer()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("player");
     // create a new player and insert into mySQL
     $player = new Player(null, $this->VALID_PLAYERAPIID, $this->team->getTeamId(), $this->sport->getSportId(), $this->VALID_PLAYERNAME);
     $player->insert($this->getPDO());
     // delete the player from mySQL
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("player"));
     $player->delete($this->getPDO());
     // grab the data from mySQL and enforce the player does not exist
     $pdoPlayer = player::getPlayerByPlayerId($this->getPDO(), $player->getPlayerId());
     $this->assertNull($pdoPlayer);
     $this->assertEquals($numRows, $this->getConnection()->getRowCount("player"));
 }