[BUGFIX] Failling unit test in GeneralUtilityTest for Windows system 42/36442/2
authorNicole Cordes <typo3@cordes.co>
Fri, 30 Jan 2015 15:13:20 +0000 (16:13 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 30 Jan 2015 15:39:54 +0000 (16:39 +0100)
In GeneralUtilityTest a test for the TYPO3_SITE_PATH parses the result
for a starting slash. This test fails on Windows system as the don't
provide slashes but drive letters. This patch skips the test on Windows
systems and provides a new test to check for absolute paths with drive
letters.

Releases: master, 6.2
Resolves: #64644
Change-Id: I87bb9c7df7debd6e5d44602330587eff3c1cf4fd
Reviewed-on: http://review.typo3.org/36442
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php

index 5d927b9..15a2272 100644 (file)
@@ -1540,6 +1540,9 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getIndpEnvTypo3SitePathReturnsStringStartingWithSlash() {
+               if (TYPO3_OS === 'WIN') {
+                       $this->markTestSkipped('Test not available on Windows OS.');
+               }
                $result = Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
                $this->assertEquals('/', $result[0]);
        }
@@ -1547,6 +1550,17 @@ class GeneralUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
+       public function getIndpEnvTypo3SitePathReturnsStringStartingWithDrive() {
+               if (TYPO3_OS !== 'WIN') {
+                       $this->markTestSkipped('Test available only on Windows OS.');
+               }
+               $result = Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
+               $this->assertRegExp('/^[a-z]:\//i', $result);
+       }
+
+       /**
+        * @test
+        */
        public function getIndpEnvTypo3SitePathReturnsStringEndingWithSlash() {
                $result = Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
                $this->assertEquals('/', $result[strlen($result) - 1]);