Loading core/modules/user/tests/src/Functional/Views/RolesRidArgumentTest.php +25 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,11 @@ class RolesRidArgumentTest extends UserTestBase { */ public static $testViews = ['test_user_roles_rid']; /** * {@inheritdoc} */ protected static $modules = ['views_ui']; /** * {@inheritdoc} */ Loading @@ -27,12 +32,31 @@ class RolesRidArgumentTest extends UserTestBase { */ public function testArgumentTitle() { $role_id = $this->createRole([], 'markup_role_name', '<em>Role name with markup</em>'); $user = $this->createUser(); $this->createRole([], 'second_role_name', 'Second role name'); $user = $this->createUser([], 'User with role one'); $user->addRole($role_id); $user->save(); $second_user = $this->createUser([], 'User with role two'); $second_user->addRole('second_role_name'); $second_user->save(); $this->drupalGet('/user_roles_rid_test/markup_role_name'); $this->assertSession()->assertEscaped('<em>Role name with markup</em>'); $views_user = $this->drupalCreateUser(['administer views']); $this->drupalLogin($views_user); // Change the View to allow multiple values for the roles. $edit = [ 'options[break_phrase]' => TRUE, ]; $this->drupalGet('admin/structure/views/nojs/handler/test_user_roles_rid/page_1/argument/roles_target_id'); $this->submitForm($edit, 'Apply'); $this->submitForm([], 'Save'); $this->drupalGet('/user_roles_rid_test/markup_role_name+second_role_name'); $this->assertSession()->pageTextContains('User with role one'); $this->assertSession()->pageTextContains('User with role two'); } } core/modules/views/src/Plugin/views/argument/ManyToOne.php +1 −3 Original line number Diff line number Diff line Loading @@ -40,9 +40,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o protected function defineOptions() { $options = parent::defineOptions(); if (!empty($this->definition['numeric'])) { $options['break_phrase'] = ['default' => FALSE]; } $options['add_table'] = ['default' => FALSE]; $options['require_value'] = ['default' => FALSE]; Loading Loading
core/modules/user/tests/src/Functional/Views/RolesRidArgumentTest.php +25 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,11 @@ class RolesRidArgumentTest extends UserTestBase { */ public static $testViews = ['test_user_roles_rid']; /** * {@inheritdoc} */ protected static $modules = ['views_ui']; /** * {@inheritdoc} */ Loading @@ -27,12 +32,31 @@ class RolesRidArgumentTest extends UserTestBase { */ public function testArgumentTitle() { $role_id = $this->createRole([], 'markup_role_name', '<em>Role name with markup</em>'); $user = $this->createUser(); $this->createRole([], 'second_role_name', 'Second role name'); $user = $this->createUser([], 'User with role one'); $user->addRole($role_id); $user->save(); $second_user = $this->createUser([], 'User with role two'); $second_user->addRole('second_role_name'); $second_user->save(); $this->drupalGet('/user_roles_rid_test/markup_role_name'); $this->assertSession()->assertEscaped('<em>Role name with markup</em>'); $views_user = $this->drupalCreateUser(['administer views']); $this->drupalLogin($views_user); // Change the View to allow multiple values for the roles. $edit = [ 'options[break_phrase]' => TRUE, ]; $this->drupalGet('admin/structure/views/nojs/handler/test_user_roles_rid/page_1/argument/roles_target_id'); $this->submitForm($edit, 'Apply'); $this->submitForm([], 'Save'); $this->drupalGet('/user_roles_rid_test/markup_role_name+second_role_name'); $this->assertSession()->pageTextContains('User with role one'); $this->assertSession()->pageTextContains('User with role two'); } }
core/modules/views/src/Plugin/views/argument/ManyToOne.php +1 −3 Original line number Diff line number Diff line Loading @@ -40,9 +40,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o protected function defineOptions() { $options = parent::defineOptions(); if (!empty($this->definition['numeric'])) { $options['break_phrase'] = ['default' => FALSE]; } $options['add_table'] = ['default' => FALSE]; $options['require_value'] = ['default' => FALSE]; Loading