/** * test inserting a Crew, editing it and then updating it **/ public function testUpdateValidCrew() { //count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("crew"); //create a new Crew and insert to 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->setCrewLocation($this->VALID_CREWLOCATION2); $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()); $this->assertEquals($pdoCrew->getCrewLocation(), $this->VALID_CREWLOCATION2); }