예제 #1
0
 /**
  * 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
 /**
  * Tests that invalid YAML throws an exception.
  *
  * @covers ::decode
  * @expectedException \Drupal\Component\Serialization\Exception\InvalidDataTypeException
  */
 public function testError()
 {
     YamlSymfony::decode('foo: [ads');
 }