You are here

public function TestBaseTest::testRandomString in SimpleTest 8.3

@covers ::randomString @dataProvider providerRandomItems

File

tests/src/Unit/TestBaseTest.php, line 111

Class

TestBaseTest
@requires extension curl @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest @group TestBase

Namespace

Drupal\Tests\simpletest\Unit

Code

public function testRandomString($length) {
  $mock_test_base = $this
    ->getMockForAbstractClass('Drupal\\simpletest\\TestBase');
  $string = $mock_test_base
    ->randomString($length);
  $this
    ->assertEquals($length, strlen($string));

  // randomString() should always include an ampersand ('&')  and a
  // greater than ('>') if $length is greater than 3.
  if ($length > 4) {
    $this
      ->assertContains('&', $string);
    $this
      ->assertContains('>', $string);
  }
}