Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / Drupal / Tests / Component / Utility / RandomTest.php
index 64f0eaac1bd4053b87f1e6dcbb44c0e7e724cfa5..7523c8be0670b9f4a3df79a1aaf7e5a572ef748a 100644 (file)
@@ -62,7 +62,12 @@ class RandomTest extends TestCase {
     // 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 @@ class RandomTest extends TestCase {
     // 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;