public function testMutators() { $str = new Text('it'); $this->assertEquals('let it', $str->prepend('let ')); $this->assertEquals('let it', $str->prepend(new Text('let '))); $this->assertEquals('it go', $str->append(' go')); $this->assertEquals('it go', $str->append(new Text(' go'))); }
/** * Returns the path obtained from the concatenation of the given path's * segments/string to the end of this path. * * @param string|Text|Path $path * @return Path */ public function append($path) { if ($path instanceof Path) { $path = $path->getPathname(); } if (!$this->hasTrailingSeparator()) { $this->addTrailingSeparator(); } return new Path($this->pathname->append($path)); }