function ArgumentValidateTest::testArgumentValidateUserEither in Views (for Drupal 7) 8.3
File
- lib/
Drupal/ views/ Tests/ User/ ArgumentValidateTest.php, line 59 - Definition of Drupal\views\Tests\User\ArgumentValidateTest.
Class
- ArgumentValidateTest
- Tests views user argument argument handler.
Namespace
Drupal\views\Tests\UserCode
function testArgumentValidateUserEither() {
$account = $this->account;
// test 'either' case
$view = $this
->view_argument_validate_user('either');
$this
->assertTrue($view->argument['null']
->validateArgument($account->name));
// Reset safed argument validation.
$view->argument['null']->argument_validated = NULL;
// Fail for a uid variable since type is 'name'
$this
->assertTrue($view->argument['null']
->validateArgument($account->uid));
// Reset safed 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
->randomName()));
// Reset safed argument validation.
$view->argument['null']->argument_validated = NULL;
// Fail for a valid uid, but for a user that doesn't exist
$this
->assertFalse($view->argument['null']
->validateArgument(32));
}