Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Component / Plugin / Context / ContextTest.php
index 6a2cf4667321ffa6b6a79d5bf3f7ee587960e94a..aee8d093189308257e09abcd9ab560a1b62b1cf9 100644 (file)
@@ -71,10 +71,16 @@ class ContextTest extends TestCase {
 
       // Set expectation for exception.
       if ($is_required) {
-        $this->setExpectedException(
-          'Drupal\Component\Plugin\Exception\ContextException',
-          sprintf("The %s context is required and not present.", $data_type)
-        );
+        if (method_exists($this, 'expectException')) {
+          $this->expectException('Drupal\Component\Plugin\Exception\ContextException');
+          $this->expectExceptionMessage(sprintf("The %s context is required and not present.", $data_type));
+        }
+        else {
+          $this->setExpectedException(
+            'Drupal\Component\Plugin\Exception\ContextException',
+            sprintf("The %s context is required and not present.", $data_type)
+          );
+        }
       }
 
       // Exercise getContextValue().