[TASK] Skip test for Yaml PHP extension if not loaded 73/55673/2
authorSusanne Moog <susanne.moog@typo3.org>
Mon, 12 Feb 2018 11:17:50 +0000 (12:17 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 12 Feb 2018 11:37:27 +0000 (12:37 +0100)
Resolves: #83861
Releases: master, 8.7
Change-Id: I235e5e37405b264ce071c8d6ecb2b0c13f64357c
Reviewed-on: https://review.typo3.org/55673
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/form/Tests/Unit/Mvc/Configuration/YamlSourceTest.php

index e51be26..ec830f5 100644 (file)
@@ -70,20 +70,21 @@ class YamlSourceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function loadThrowsExceptionIfFileToLoadIsNotValidYamlUsePhpExtensionParser()
     {
-        if (extension_loaded('yaml')) {
-            $this->expectException(ParseErrorException::class);
-            $this->expectExceptionCode(1391894094);
+        if (!extension_loaded('yaml')) {
+            $this->markTestSkipped('Yaml PHP extension not available, skipping.');
+        }
+        $this->expectException(ParseErrorException::class);
+        $this->expectExceptionCode(1391894094);
 
-            $mockYamlSource = $this->getAccessibleMock(YamlSource::class, [
-                'dummy',
-            ], [], '', false);
+        $mockYamlSource = $this->getAccessibleMock(YamlSource::class, [
+            'dummy',
+        ], [], '', false);
 
-            $input = [
-                'EXT:form/Tests/Unit/Mvc/Configuration/Fixtures/Invalid.yaml'
-            ];
+        $input = [
+            'EXT:form/Tests/Unit/Mvc/Configuration/Fixtures/Invalid.yaml'
+        ];
 
-            $mockYamlSource->_call('load', $input);
-        }
+        $mockYamlSource->_call('load', $input);
     }
 
     /**