public function HandlerFilterUserNameTest::testAdminUserInterface in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Tests/Views/HandlerFilterUserNameTest.php \Drupal\user\Tests\Views\HandlerFilterUserNameTest::testAdminUserInterface()
Tests using the user interface.
File
- core/
modules/ user/ src/ Tests/ Views/ HandlerFilterUserNameTest.php, line 91 - Contains \Drupal\user\Tests\Views\HandlerFilterUserNameTest.
Class
- HandlerFilterUserNameTest
- Tests the handler of the user: name filter.
Namespace
Drupal\user\Tests\ViewsCode
public function testAdminUserInterface() {
$admin_user = $this
->drupalCreateUser(array(
'administer views',
'administer site configuration',
));
$this
->drupalLogin($admin_user);
$path = 'admin/structure/views/nojs/handler/test_user_name/default/filter/uid';
$this
->drupalGet($path);
// Pass in an invalid username, the validation should catch it.
$users = array(
$this
->randomMachineName(),
);
$users = array_map('strtolower', $users);
$edit = array(
'options[value]' => implode(', ', $users),
);
$this
->drupalPostForm($path, $edit, t('Apply'));
$this
->assertRaw(t('There are no entities matching "%value".', array(
'%value' => implode(', ', $users),
)));
// Pass in an invalid username and a valid username.
$random_name = $this
->randomMachineName();
$users = array(
$random_name,
$this->names[0],
);
$users = array_map('strtolower', $users);
$edit = array(
'options[value]' => implode(', ', $users),
);
$users = array(
$users[0],
);
$this
->drupalPostForm($path, $edit, t('Apply'));
$this
->assertRaw(t('There are no entities matching "%value".', array(
'%value' => implode(', ', $users),
)));
// Pass in just valid usernames.
$users = $this->names;
$users = array_map('strtolower', $users);
$edit = array(
'options[value]' => implode(', ', $users),
);
$this
->drupalPostForm($path, $edit, t('Apply'));
$this
->assertNoRaw(t('There are no entities matching "%value".', array(
'%value' => implode(', ', $users),
)));
}