/** * test grabbing a Sport by the League **/ public function testGetValidSportBySportLeague() { // count the number of rows, and save it for later $numRows = $this->getConnection()->getRowCount("sport"); //create a new sport and insert it into the db $sportLeague = new Sport(null, $this->VALID_SPORTLEAGUE, $this->VALID_SPORTNAME); $sportLeague->insert($this->getPDO()); //grab the data from the db and enforce the fields match our expectations $results = Sport::getSportBySportLeague($this->getPDO(), $sportLeague->getSportLeague()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("sport")); $this->assertCount(1, $results); $this->assertContainsOnlyInstancesOf("Edu\\Cnm\\Sprots\\Sport", $results); //grab the results from teh array and validate it $pdoSportLeague = $results[0]; $this->assertEquals($pdoSportLeague->getSportLeague(), $this->VALID_SPORTLEAGUE); }