예제 #1
0
 /**
  * test inserting a Crew and re-grabbing it form mySQL
  **/
 public function testGetValidCrewByCrewId()
 {
     //count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("crew");
     //create a new Crew and insert it into mySQL
     $crew = new Crew(null, $this->company->getCompanyId(), $this->VALID_CREWLOCATION);
     $crew->insert($this->getPDO());
     //edit the crew and update it in mySQL
     $crew->update($this->getPDO());
     //grab the data from mySQL and enforce the fields match our expectations
     $pdoCrew = Crew::getCrewByCrewId($this->getPDO(), $crew->getCrewId());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("crew"));
     $this->assertEquals($pdoCrew->getCrewCompanyId(), $this->company->getCompanyId());
 }