public function TestBaseTest::testRandomString in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/tests/src/Unit/TestBaseTest.php \Drupal\Tests\simpletest\Unit\TestBaseTest::testRandomString()
@covers ::randomString @dataProvider providerRandomItems
File
- core/
modules/ simpletest/ tests/ src/ Unit/ TestBaseTest.php, line 114 - Contains \Drupal\Tests\simpletest\Unit\TestBaseTest.
Class
- TestBaseTest
- @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest
Namespace
Drupal\Tests\simpletest\UnitCode
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);
}
}