FilterPermissionUiTest.php in Zircon Profile 8
File
core/modules/user/src/Tests/Views/FilterPermissionUiTest.php
View source
<?php
namespace Drupal\user\Tests\Views;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
class FilterPermissionUiTest extends ViewTestBase {
public static $testViews = [
'test_filter_permission',
];
public static $modules = [
'user',
'user_test_views',
'views_ui',
];
protected function setUp() {
parent::setUp(TRUE);
ViewTestData::createTestViews(get_class($this), array(
'user_test_views',
));
$this
->enableViewsTestModule();
}
public function testHandlerUI() {
$this
->drupalLogin($this
->drupalCreateUser([
'administer views',
'administer users',
]));
$this
->drupalGet('admin/structure/views/view/test_filter_permission/edit/default');
$this
->assertLink('User: Permission (= View user information)');
$this
->drupalPostForm(NULL, [], 'Save');
$this
->assertNoText('No valid values found on filter: User: Permission.');
$this
->assertText('The view test_filter_permission has been saved.');
$edit = [
'options[value][]' => [
'access user profiles',
'administer views',
],
];
$this
->drupalPostForm('admin/structure/views/nojs/handler/test_filter_permission/default/filter/permission', $edit, 'Apply');
$this
->assertLink('User: Permission (or View us…)');
$this
->drupalPostForm(NULL, [], 'Save');
$this
->assertNoText('No valid values found on filter: User: Permission.');
$this
->assertText('The view test_filter_permission has been saved.');
}
}