[BUGFIX] Failling unit test in GeneralUtilityTest for Windows system 37/36437/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:08 +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/36437
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php

index 84569df..fb8f740 100644 (file)
@@ -1532,6 +1532,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]);
        }
@@ -1539,6 +1542,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]);