1 user_views_argument_validate.test UserViewsArgumentValidate::testArgumentValidateUserUid()

File

core/modules/user/tests/user_views_argument_validate.test, line 24
Definition of UserViewsArgumentValidate.

Class

UserViewsArgumentValidate
Tests views user argument argument handler.

Code

function testArgumentValidateUserUid() {
  $account = $this->account;
  // test 'uid' case
  $view = $this->view_argument_validate_user('uid');
  $view->set_display('default');
  $view->pre_execute();
  $view->init_handlers();
  $this->assertTrue($view->argument['null']->validate_arg($account->uid));
  // Reset safe argument validation.
  $view->argument['null']->argument_validated = NULL;
  // Fail for a string variable since type is 'uid'
  $this->assertFalse($view->argument['null']->validate_arg($account->name));
  // Reset safe argument validation.
  $view->argument['null']->argument_validated = NULL;
  // Fail for a valid numeric, but for a user that doesn't exist
  $this->assertFalse($view->argument['null']->validate_arg(32));
}