Browse Source

[Yaml] fixed tests when iconv and mbstring PHP extensions are not available

Fabien Potencier 13 năm trước cách đây
mục cha
commit
9b5be1df2a
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      tests/Symfony/Tests/Component/Yaml/ParserTest.php

+ 8 - 2
tests/Symfony/Tests/Component/Yaml/ParserTest.php

@@ -32,8 +32,14 @@ class ParserTest extends \PHPUnit_Framework_TestCase
     /**
      * @dataProvider getDataFormSpecifications
      */
-    public function testSpecifications($expected, $yaml, $comment)
+    public function testSpecifications($file, $expected, $yaml, $comment)
     {
+        if ('escapedCharacters' == $file) {
+            if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
+                $this->markTestSkipped('The iconv and mbstring extensions are not available.');
+            }
+        }
+
         $this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment);
     }
 
@@ -59,7 +65,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
                 } else {
                     $expected = var_export(eval('return '.trim($test['php']).';'), true);
 
-                    $tests[] = array($expected, $test['yaml'], $test['test']);
+                    $tests[] = array($file, $expected, $test['yaml'], $test['test']);
                 }
             }
         }