diff core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php	Mon Apr 23 09:46:53 2018 +0100
@@ -59,7 +59,12 @@
    * @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 @@
    * @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]);