X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FRandomTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FRandomTest.php;h=7523c8be0670b9f4a3df79a1aaf7e5a572ef748a;hp=64f0eaac1bd4053b87f1e6dcbb44c0e7e724cfa5;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/web/core/tests/Drupal/Tests/Component/Utility/RandomTest.php index 64f0eaac1..7523c8be0 100644 --- a/web/core/tests/Drupal/Tests/Component/Utility/RandomTest.php +++ b/web/core/tests/Drupal/Tests/Component/Utility/RandomTest.php @@ -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;