Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Component / Plugin / Discovery / DiscoveryTraitTest.php
index c37a4b5a18d3757b8536146cdc9df562823dfa4d..1a5c36e7b85436e0e8672523c88d00d8799a7a72 100644 (file)
@@ -69,7 +69,12 @@ class DiscoveryTraitTest extends TestCase {
     $method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
     $method_ref->setAccessible(TRUE);
     // Call doGetDefinition, with $exception_on_invalid always TRUE.
-    $this->setExpectedException(PluginNotFoundException::class);
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(PluginNotFoundException::class);
+    }
+    else {
+      $this->setExpectedException(PluginNotFoundException::class);
+    }
     $method_ref->invoke($trait, $definitions, $plugin_id, TRUE);
   }
 
@@ -106,7 +111,12 @@ class DiscoveryTraitTest extends TestCase {
       ->method('getDefinitions')
       ->willReturn($definitions);
     // Call getDefinition(), with $exception_on_invalid always TRUE.
-    $this->setExpectedException(PluginNotFoundException::class);
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(PluginNotFoundException::class);
+    }
+    else {
+      $this->setExpectedException(PluginNotFoundException::class);
+    }
     $trait->getDefinition($plugin_id, TRUE);
   }