diff core/tests/Drupal/Tests/Component/Utility/RandomTest.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/Utility/RandomTest.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php	Mon Apr 23 09:46:53 2018 +0100
@@ -62,7 +62,12 @@
     // There are fewer than 100 possibilities so an exception should occur to
     // prevent infinite loops.
     $random = new Random();
-    $this->setExpectedException(\RuntimeException::class);
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(\RuntimeException::class);
+    }
+    else {
+      $this->setExpectedException(\RuntimeException::class);
+    }
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->name(1, TRUE);
       $names[$str] = TRUE;
@@ -78,7 +83,12 @@
     // There are fewer than 100 possibilities so an exception should occur to
     // prevent infinite loops.
     $random = new Random();
-    $this->setExpectedException(\RuntimeException::class);
+    if (method_exists($this, 'expectException')) {
+      $this->expectException(\RuntimeException::class);
+    }
+    else {
+      $this->setExpectedException(\RuntimeException::class);
+    }
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->string(1, TRUE);
       $names[$str] = TRUE;