/** * Test grabbing all of Names **/ public function testGetAllValidSportNames() { // 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 $sport = new Sport(null, $this->VALID_SPORTLEAGUE, $this->VALID_SPORTNAME); $sport->insert($this->getPDO()); // grab the data from the db and enforce the fields match our expectations $results = Sport::getAllSportNames($this->getPDO()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("sport")); $this->assertCount(1, $results); $this->assertContainsOnlyInstancesOf("Edu\\Cnm\\Sprots\\Sport", $results); //grab the results from the array and validate it $pdoSport = $results[0]; $this->assertEquals($pdoSport->getSportName(), $this->VALID_SPORTNAME); }