/** * test creating a Trail Relationship and then deleting it * * grabs the data from mySQL via getTrailRelationshipBySegmentIdAndTrailId **/ public function testDeleteValidTrailRelationshipBySegmentIdAndTrailId() { // 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()); // delete the Trail Relationship from mySQL $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("trailRelationship")); $trailRelationship->delete($this->getPDO()); //grab the data from my mySQL and enforce the Trail Relationship does not exist $pdoTrailRelationship = TrailRelationship::getTrailRelationshipBySegmentIdAndTrailId($this->getPDO(), $trailRelationship->getSegmentId(), $trailRelationship->getTrailId()); $this->assertNull($pdoTrailRelationship); $this->assertSame($numRows, $this->getConnection()->getRowCount("trailRelationship")); }