Skip to content

Commit

Permalink
Merge 094be8f into 7e5395c
Browse files Browse the repository at this point in the history
  • Loading branch information
carterqw committed Nov 27, 2014
2 parents 7e5395c + 094be8f commit eb5de36
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Assetic/Factory/AssetFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function generateAssetName($inputs, $filters, $options = array())
$partPaths = pathinfo($path);

$name = str_replace($options['root'], '', $path);
$name = str_replace($partPaths['basename'], '', $name);
$name = dirname($name);

return ltrim($name . $partPaths['filename'], '/');
return ltrim("{$name}/{$partPaths['filename']}", '/');
}
}
12 changes: 12 additions & 0 deletions tests/Assetic/Factory/AssetFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ public function testGenerateAssetName()
$assetFactory->generateAssetName(array(__FILE__), array(), array('root' => $root))
);
}

public function testGenerateAssetNameWithAssetNameEqualsToFolderName()
{
$root = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..');

$assetFactory = new AssetFactory($root);

$this->assertEquals(
'some_dir/normalize.css/normalize',
$assetFactory->generateAssetName(array("/some_dir/normalize.css/normalize.css"), array(), array('root' => $root))
);
}
}

0 comments on commit eb5de36

Please sign in to comment.