Mercurial > hg > isophonics-drupal-site
view core/modules/user/src/Tests/Views/FilterPermissionUiTest.php @ 9:1fc0ff908d1f
Add another data file
author | Chris Cannam |
---|---|
date | Mon, 05 Feb 2018 12:34:32 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\user\Tests\Views; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; /** * Tests the permission field handler ui. * * @group user * @see \Drupal\user\Plugin\views\filter\Permissions */ class FilterPermissionUiTest extends ViewTestBase { /** * Views used by this test. * * @var array */ public static $testViews = ['test_filter_permission']; /** * Modules to enable. * * @var array */ public static $modules = ['user', 'user_test_views', 'views_ui']; protected function setUp() { parent::setUp(TRUE); ViewTestData::createTestViews(get_class($this), ['user_test_views']); $this->enableViewsTestModule(); } /** * Tests basic filter handler settings in the UI. */ public function testHandlerUI() { $this->drupalLogin($this->drupalCreateUser(['administer views', 'administer users'])); $this->drupalGet('admin/structure/views/view/test_filter_permission/edit/default'); // Verify that the handler summary is correctly displaying the selected // permission. $this->assertLink('User: Permission (= View user information)'); $this->drupalPostForm(NULL, [], 'Save'); // Verify that we can save the view. $this->assertNoText('No valid values found on filter: User: Permission.'); $this->assertText('The view test_filter_permission has been saved.'); // Verify that the handler summary is also correct when multiple values are // selected in the filter. $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'); // Verify that we can save the view. $this->assertNoText('No valid values found on filter: User: Permission.'); $this->assertText('The view test_filter_permission has been saved.'); } }