Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
60 */ | 60 */ |
61 public function testRandomNameException() { | 61 public function testRandomNameException() { |
62 // There are fewer than 100 possibilities so an exception should occur to | 62 // There are fewer than 100 possibilities so an exception should occur to |
63 // prevent infinite loops. | 63 // prevent infinite loops. |
64 $random = new Random(); | 64 $random = new Random(); |
65 $this->setExpectedException(\RuntimeException::class); | 65 if (method_exists($this, 'expectException')) { |
66 $this->expectException(\RuntimeException::class); | |
67 } | |
68 else { | |
69 $this->setExpectedException(\RuntimeException::class); | |
70 } | |
66 for ($i = 0; $i <= 100; $i++) { | 71 for ($i = 0; $i <= 100; $i++) { |
67 $str = $random->name(1, TRUE); | 72 $str = $random->name(1, TRUE); |
68 $names[$str] = TRUE; | 73 $names[$str] = TRUE; |
69 } | 74 } |
70 } | 75 } |
76 */ | 81 */ |
77 public function testRandomStringException() { | 82 public function testRandomStringException() { |
78 // There are fewer than 100 possibilities so an exception should occur to | 83 // There are fewer than 100 possibilities so an exception should occur to |
79 // prevent infinite loops. | 84 // prevent infinite loops. |
80 $random = new Random(); | 85 $random = new Random(); |
81 $this->setExpectedException(\RuntimeException::class); | 86 if (method_exists($this, 'expectException')) { |
87 $this->expectException(\RuntimeException::class); | |
88 } | |
89 else { | |
90 $this->setExpectedException(\RuntimeException::class); | |
91 } | |
82 for ($i = 0; $i <= 100; $i++) { | 92 for ($i = 0; $i <= 100; $i++) { |
83 $str = $random->string(1, TRUE); | 93 $str = $random->string(1, TRUE); |
84 $names[$str] = TRUE; | 94 $names[$str] = TRUE; |
85 } | 95 } |
86 } | 96 } |