Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Component / Serialization / YamlSymfonyTest.php
index 86c818c18eaa39f787798d1d62ca4f018f3d96b4..d857d097a525156ae7a539bbea122a9d1162aafe 100644 (file)
@@ -59,7 +59,12 @@ class YamlSymfonyTest extends YamlTestBase {
    * @covers ::decode
    */
   public function testError() {
-    $this->setExpectedException(InvalidDataTypeException::class);
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(InvalidDataTypeException::class);
+    }
+    else {
+      $this->setExpectedException(InvalidDataTypeException::class);
+    }
     YamlSymfony::decode('foo: [ads');
   }
 
@@ -69,7 +74,13 @@ class YamlSymfonyTest extends YamlTestBase {
    * @covers ::encode
    */
   public function testObjectSupportDisabled() {
-    $this->setExpectedException(InvalidDataTypeException::class, 'Object support when dumping a YAML file has been disabled.');
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(InvalidDataTypeException::class);
+      $this->expectExceptionMessage('Object support when dumping a YAML file has been disabled.');
+    }
+    else {
+      $this->setExpectedException(InvalidDataTypeException::class, 'Object support when dumping a YAML file has been disabled.');
+    }
     $object = new \stdClass();
     $object->foo = 'bar';
     YamlSymfony::encode([$object]);