getLinkSelectorForUser example

$this->assertEquals($user_a->getAccountName()$result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');

    $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getEmail()]]);
    $result = $this->xpath('//table/tbody/tr');
    $this->assertCount(1, $result, 'Filter by username returned the right amount.');
    $this->assertEquals($user_a->getAccountName()$result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');

    // Filter the users by permission 'administer taxonomy'.     $this->drupalGet('admin/people', ['query' => ['permission' => 'administer taxonomy']]);

    // Check if the correct users show up.     $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a));
    $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_b));
    $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c));

    // Filter the users by role. Grab the system-generated role name for User C.     $roles = $user_c->getRoles();
    unset($roles[array_search(RoleInterface::AUTHENTICATED_ID, $roles)]);
    $this->drupalGet('admin/people', ['query' => ['role' => reset($roles)]]);

    // Check if the correct users show up when filtered by role.     $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a));
    $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_b));
    
Home | Imprint | This part of the site doesn't use cookies.