Skip to content

Commit

Permalink
Fix Path::normalize() stripping folders named '0' [fixed #112]
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Adámek committed Nov 27, 2015
1 parent 37cae88 commit 50aa2b3
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 50aa2b3

Please sign in to comment.