Fix issue with directory separators for zip:// on Windows

Replaced "/" by DIRECTORY_SEPARATOR every time it was used with zip://
This commit is contained in:
Adrien Loison committed 2015-05-12 20:51:57 -07:00
1 parent 69190cd855
commit fb0175d633
5 files changed
+38 -8

No files matched your search

+10 -1
View File
@@ -90,9 +90,18 @@ class SheetTest extends \PHPUnit_Framework_TestCase
*/
private function assertSheetNameEquals($expectedName, $resourcePath, $message = '')
{
$pathToWorkbookFile = $resourcePath . '#xl/workbook.xml';
$pathToWorkbookFile = $resourcePath . $this->normalizePath('#xl/workbook.xml');
$xmlContents = file_get_contents('zip://' . $pathToWorkbookFile);
$this->assertContains('<sheet name="' . $expectedName . '"', $xmlContents, $message);
}
/**
* @param string $path
* @return string The path with the correct directory separators, as defined for the current platform
*/
private function normalizePath($path)
{
return str_replace('/', DIRECTORY_SEPARATOR, $path);
}
}