function UserMatcherTest::testUserMatcherWidthIncludeBlocked in Linkit 8.4
Tests user matcher with include blocked setting activated.
File
- src/
Tests/ Matchers/ UserMatcherTest.php, line 94 - Contains \Drupal\linkit\Tests\Matchers\UserMatcherTest.
Class
- UserMatcherTest
- Tests user matcher.
Namespace
Drupal\linkit\Tests\MatchersCode
function testUserMatcherWidthIncludeBlocked() {
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->manager
->createInstance('entity:user', [
'settings' => [
'include_blocked' => TRUE,
],
]);
// Test without permissions to see blocked users.
$matches = $plugin
->getMatches('blocked');
$this
->assertEqual(0, count($matches), 'Correct number of matches');
$account = $this
->drupalCreateUser([
'administer users',
]);
$this
->drupalLogin($account);
// Test with permissions to see blocked users.
$matches = $plugin
->getMatches('blocked');
$this
->assertEqual(1, count($matches), 'Correct number of matches');
}