You are here

public function RandomTest::testRandomStringValidator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/RandomTest.php \Drupal\Tests\Component\Utility\RandomTest::testRandomStringValidator()

Tests random string validation callbacks.

@covers ::string

File

core/tests/Drupal/Tests/Component/Utility/RandomTest.php, line 143
Contains \Drupal\Tests\Component\Utility\RandomTest.

Class

RandomTest
Tests random data generation.

Namespace

Drupal\Tests\Component\Utility

Code

public function testRandomStringValidator() {
  $random = new Random();
  $this->firstStringGenerated = '';
  $str = $random
    ->string(1, TRUE, array(
    $this,
    '_RandomStringValidate',
  ));
  $this
    ->assertNotEquals($this->firstStringGenerated, $str);
}