function ArgumentValidateTest::testArgumentValidateUserName
Same name in other branches
- 9 core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php \Drupal\Tests\user\Kernel\Views\ArgumentValidateTest::testArgumentValidateUserName()
- 8.9.x core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php \Drupal\Tests\user\Kernel\Views\ArgumentValidateTest::testArgumentValidateUserName()
- 10 core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php \Drupal\Tests\user\Kernel\Views\ArgumentValidateTest::testArgumentValidateUserName()
Tests the UserName argument validator.
File
-
core/
modules/ user/ tests/ src/ Kernel/ Views/ ArgumentValidateTest.php, line 78
Class
- ArgumentValidateTest
- Tests user argument validators for ID and name.
Namespace
Drupal\Tests\user\Kernel\ViewsCode
public function testArgumentValidateUserName() : void {
$view = Views::getView('test_view_argument_validate_username');
$this->executeView($view);
$this->assertTrue($view->argument['null']
->validateArgument($this->account
->getAccountName()));
// Reset argument validation.
$view->argument['null']->argument_validated = NULL;
// Fail for a valid string, but for a user that doesn't exist
$this->assertFalse($view->argument['null']
->validateArgument($this->randomMachineName()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.