Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature-fix-basepath' of /~https://github.com/rafalwrzesz…
Browse files Browse the repository at this point in the history
…cz/zf2 into hotfix/view-helper-basepath
  • Loading branch information
weierophinney committed Jan 6, 2012
9 parents 702ec03 + 14c7cd8 + 5a55cdf + c9e475e + 1fa3bfc + 3a78ba4 + a774960 + c3a8db3 + 8f1532b commit b0695b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Helper/BasePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __invoke($file = null)
*/
public function setBasePath($basePath)
{
$this->basePath = $basePath;
$this->basePath = rtrim($basePath, '/');
return $this;
}
}
8 changes: 8 additions & 0 deletions test/Helper/BasePathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public function testBasePathWithFile()
$this->assertEquals('/foo/bar', $helper('bar'));
}

public function testBasePathNoDoubleSlashes()
{
$helper = new BasePath();
$helper->setBasePath('/');

$this->assertEquals('/', $helper('/'));
}

public function testBasePathWithFilePrefixedBySlash()
{
$helper = new BasePath();
Expand Down

0 comments on commit b0695b0

Please sign in to comment.