Skip to content
Snippets Groups Projects

Issue #2972573: randomMachineName() should conform to processMachineName() pattern

Open Issue #2972573: randomMachineName() should conform to processMachineName() pattern
2 unresolved threads
2 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
130 }
131 }
132
133 /**
134 * Tests infinite loop prevention whilst generating random names.
135 *
136 * @covers ::machineName
137 */
138 public function testRandomMachineNameException(): void {
139 // There are fewer than 100 possibilities so an exception should occur to
140 // prevent infinite loops.
141 $random = new Random();
142 $this->expectException(\RuntimeException::class);
143 for ($i = 0; $i <= 100; $i++) {
144 $str = $random->machineName(1, TRUE);
145 $names[$str] = TRUE;
  • 146 }
    147 }
    148
    149 /**
    150 * Tests random name generation if uniqueness is not enforced.
    151 *
    152 * @covers ::machineName
    153 */
    154 public function testRandomMachineNameNonUnique(): void {
    155 // There are fewer than 100 possibilities if we were forcing uniqueness so
    156 // exception would occur.
    157 $random = new Random();
    158 for ($i = 0; $i <= 100; $i++) {
    159 $random->machineName(1);
    160 }
    161 $this->assertTrue(TRUE, 'No exception thrown when uniqueness is not enforced.');
  • added 227 commits

    Compare with previous version

  • Andrey Postnikov
    Andrey Postnikov @andypost started a thread on commit 2fc7e23e
  • 1 1 <?php
    2 2
    3 namespace Drupal\Tests\system\Functional\Common;
    3 namespace Drupal\Tests\system\FunctionalJavaScript;
    Please register or sign in to reply
    Loading