From 4e46236e1629997605f07748fdd57e0abe976e96 Mon Sep 17 00:00:00 2001 From: Nicole Cordes <typo3@cordes.co> Date: Fri, 30 Jan 2015 18:07:21 +0100 Subject: [PATCH] [BUGFIX] Failing unit tests due to wrong path handling In some tests of the StandaloneViewTest case the configured expections aren't met which results in failing tests on Windows systems. The mock is configured to return values when calling with giving parameter. The parameter contains the path to a layout root. During runtime the used paths are converted to unix like paths but the tests are configured to expect Windows paths (forward slashes vs. backward slashes). This patch converts paths to unix like paths before the expectations are configured to not fail on Windows systems. Releases: master, 6.2 Resolves: #64656 Change-Id: Ie362cc4e2efa41b6cee068e60313c1bfb22340b2 Reviewed-on: http://review.typo3.org/36455 Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> --- typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php b/typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php index b189287aba35..adc4d6e5a864 100644 --- a/typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php +++ b/typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php @@ -252,7 +252,7 @@ class StandaloneViewTest extends UnitTestCase { * @test */ public function renderLoadsSpecifiedTemplateFileAndPassesSourceToTemplateParser() { - $templatePathAndFilename = __DIR__ . '/Fixtures/StandaloneViewFixture.html'; + $templatePathAndFilename = GeneralUtility::fixWindowsFilePath(__DIR__) . '/Fixtures/StandaloneViewFixture.html'; $expectedResult = file_get_contents($templatePathAndFilename); $this->view->setTemplatePathAndFilename($templatePathAndFilename); $this->view->expects($this->once())->method('testFileExistence')->with($templatePathAndFilename)->will($this->returnValue(TRUE)); @@ -373,7 +373,7 @@ class StandaloneViewTest extends UnitTestCase { * @test */ public function getLayoutSourceReturnsContentOfLayoutFileForTheDefaultFormat() { - $layoutRootPath = __DIR__ . '/Fixtures'; + $layoutRootPath = GeneralUtility::fixWindowsFilePath(__DIR__) . '/Fixtures'; $this->view->setLayoutRootPath($layoutRootPath); $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('html')); $this->view->expects($this->once())->method('testFileExistence')->with($layoutRootPath . '/LayoutFixture.html')->will($this->returnValue(TRUE)); @@ -386,7 +386,7 @@ class StandaloneViewTest extends UnitTestCase { * @test */ public function getLayoutSourceReturnsContentOfLayoutFileForTheSpecifiedFormat() { - $layoutRootPath = __DIR__ . '/Fixtures'; + $layoutRootPath = GeneralUtility::fixWindowsFilePath(__DIR__) . '/Fixtures'; $this->view->setLayoutRootPath($layoutRootPath); $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('xml')); $this->view->expects($this->once())->method('testFileExistence')->with($layoutRootPath . '/LayoutFixture.xml')->will($this->returnValue(TRUE)); @@ -399,7 +399,7 @@ class StandaloneViewTest extends UnitTestCase { * @test */ public function getLayoutSourceReturnsContentOfDefaultLayoutFileIfNoLayoutExistsForTheSpecifiedFormat() { - $layoutRootPath = __DIR__ . '/Fixtures'; + $layoutRootPath = GeneralUtility::fixWindowsFilePath(__DIR__) . '/Fixtures'; $this->view->setLayoutRootPath($layoutRootPath); $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('foo')); $this->view->expects($this->at(0))->method('testFileExistence')->with($layoutRootPath . '/LayoutFixture.foo')->will($this->returnValue(FALSE)); -- GitLab