/** * test grabbing a Trail Relationship by segmentType **/ public function testGetValidTrailRelationshipBySegmentType() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("trailRelationship"); //create a new Trail Relationship and insert it into mySQL $trailRelationship = new TrailRelationship($this->segment->getSegmentId(), $this->trail->getTrailId(), $this->VALID_SEGMENTTYPE); $trailRelationship->insert($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoTrailRelationship = TrailRelationship::getTrailRelationshipBySegmentType($this->getPDO(), $this->VALID_SEGMENTTYPE); $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("trailRelationship")); $this->assertSame($pdoTrailRelationship->getSegmentId(), $this->segment->getSegmentId()); $this->assertSame($pdoTrailRelationship->getTrailId(), $this->trail->getTrailId()); $this->assertSame($pdoTrailRelationship->getSegmentType(), $this->VALID_SEGMENTTYPE); }