Skip to content

Commit

Permalink
Merge pull request #113 from B4nan/master
Browse files Browse the repository at this point in the history
Fix Path::normalize() stripping folders named '0' [fixes #112]
  • Loading branch information
janmarek committed Nov 27, 2015
2 parents 37cae88 + 50aa2b3 commit 812c864
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion WebLoader/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static function normalize($path)
$res = array();

foreach ($pieces as $piece) {
if ($piece === '.' || empty($piece)) {
if ($piece === '.' || $piece === '') {
continue;
}
if ($piece === '..') {
Expand Down
16 changes: 16 additions & 0 deletions tests/Path/PathTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace WebLoader\Test\Path;

use WebLoader\Path;

class PathTest extends \PHPUnit_Framework_TestCase
{

public function testNormalize()
{
$normalized = Path::normalize('/path/to//project//that/contains/0/in/it');
$this->assertEquals('/path/to/project/that/contains/0/in/it', $normalized);
}

}

0 comments on commit 812c864

Please sign in to comment.