/** * test grabbing all Crews **/ public function testGetAllValidCrews() { //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()); //grab the data from mySQL and enforce the fields match our expectations $pdoCrews = Crew::getAllCrews($this->getPDO()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("crew")); foreach ($pdoCrews as $pdoCrew) { if ($pdoCrew->getCrewId() === $crew->getCrewId()) { $this->assertEquals($pdoCrew->getCrewId(), $crew->getCrewId()); $this->assertEquals($pdoCrew->getCrewLocation(), $crew->getCrewLocation()); $this->assertEquals($pdoCrew->getCrewCompanyId(), $crew->getCrewCompanyId()); } } }