コード例 #1
0
ファイル: YamlTest.php プロジェクト: eigentor/tommiblog
 /**
  * Tests all YAML files are decoded in the same way with Symfony and PECL.
  *
  * This test is a little bit slow but it tests that we do not have any bugs in
  * our YAML that might not be decoded correctly in any of our implementations.
  *
  * @todo This should exist as an integration test not part of our unit tests.
  *   https://www.drupal.org/node/2597730
  *
  * @requires extension yaml
  * @dataProvider providerYamlFilesInCore
  */
 public function testYamlFiles($file)
 {
     $data = file_get_contents($file);
     try {
         $this->assertEquals(YamlSymfony::decode($data), YamlPecl::decode($data), $file);
     } catch (InvalidDataTypeException $e) {
         // Provide file context to the failure so the exception message is useful.
         $this->fail("Exception thrown parsing {$file}:\n" . $e->getMessage());
     }
 }
コード例 #2
0
ファイル: YamlPeclTest.php プロジェクト: eigentor/tommiblog
 /**
  * Tests that invalid YAML throws an exception.
  *
  * @covers ::errorHandler
  * @expectedException \Drupal\Component\Serialization\Exception\InvalidDataTypeException
  */
 public function testError()
 {
     YamlPecl::decode('foo: [ads');
 }