Verified Commit d7892190 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3082287 by alexpott: \Drupal\user\Plugin\views\access\Role::access()...

Issue #3082287 by alexpott: \Drupal\user\Plugin\views\access\Role::access() does not conform to the base class documentation

(cherry picked from commit 6f29f980)
parent abb48876
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/user/src/Plugin/views/access/Role.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public static function create(ContainerInterface $container, array $configuratio
   * {@inheritdoc}
   */
  public function access(AccountInterface $account) {
    return array_intersect(array_filter($this->options['role']), $account->getRoles());
    return !empty(array_intersect(array_filter($this->options['role']), $account->getRoles()));
  }

  /**
+2 −2
Changes for core/modules/user/tests/src/Functional/Views/AccessRoleTest.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@ public function testAccessRole() {
    $this->assertTrue($access_plugin instanceof Role, 'Make sure the right class got instantiated.');

    // Test the access() method on the access plugin.
    $this->assertFalse($executable->display_handler->access($this->webUser));
    $this->assertTrue($executable->display_handler->access($this->normalUser));
    $this->assertSame(FALSE, $executable->display_handler->access($this->webUser));
    $this->assertSame(TRUE, $executable->display_handler->access($this->normalUser));

    $this->drupalLogin($this->webUser);
    $this->drupalGet('test-role');