public function testTrailingSlash() { $p = new Path('stairway/to/hell'); $this->assertFalse($p->hasTrailingSeparator()); $p->addTrailingSeparator(); $this->assertTrue($p->hasTrailingSeparator()); $p->removeTrailingSeparator(); $this->assertFalse($p->hasTrailingSeparator()); }
/** * Makes the path relative to another given path * * @param Path $base * @return Path the new relative path */ public function makeRelativeTo(Path $base) { $pathname = clone $this->pathname; return new Path($pathname->replace($base->removeTrailingSeparator()->getPathname(), '')); }