public function testPath() { $path = new Simples_Path('/root/'); $this->assertEquals('/root/', (string) $path); $path->directory('sub'); $this->assertEquals('/root/sub/', (string) $path); $path->param('param', 'value'); $this->assertEquals('/root/sub/?param=value', (string) $path); $path->params(array('other' => 'value')); $this->assertEquals('/root/sub/?param=value&other=value', (string) $path); $path->directories(array('other', 'again')); $this->assertEquals('/root/sub/other/again/?param=value&other=value', (string) $path); }
/** * Returns the base path for the current request. * * @return string */ public function path() { $path = new Simples_Path(); $index = $this->index(); if ($index) { $path->directory(trim($index, '/')); $type = $this->type(); if ($type) { $path->directory(trim($type, '/')); } } if ($this->definition()->path()) { $path->directory(trim($this->definition()->path(), '/')); } if ($this->definition()->inject('params')) { $path->params($this->params()); } return $path; }