public function ForcePasswordChangeServiceTest::testGetPendingUsersForRole in Force Password Change 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/Service/ForcePasswordChangeServiceTest.php \Drupal\Tests\force_password_change\Unit\Service\ForcePasswordChangeServiceTest::testGetPendingUsersForRole()
* @covers ::getPendingUsersForRole
File
- tests/
src/ Unit/ Service/ ForcePasswordChangeServiceTest.php, line 259
Class
- ForcePasswordChangeServiceTest
- @coversDefaultClass \Drupal\force_password_change\Service\ForcePasswordChangeService @group force_password_change
Namespace
Drupal\Tests\force_password_change\Unit\ServiceCode
public function testGetPendingUsersForRole() {
$this->mapper
->expects($this
->at(0))
->method('getPendingUserIds')
->with(FALSE)
->willReturn([
1,
2,
3,
]);
$rid = 'authenticated';
$value = $this->forcePasswordChangeService
->getPendingUsersForRole($rid, TRUE);
$this
->assertEquals(3, $value, 'The pending user count value is properly returned for the authenticated role');
$this->mapper
->expects($this
->at(0))
->method('getPendingUserIds')
->with('admin')
->willReturn([
1,
2,
3,
4,
]);
$rid = 'admin';
$value = $this->forcePasswordChangeService
->getPendingUsersForRole($rid, TRUE);
$this
->assertEquals(4, $value, 'The pending user count value is properly returned for the admin role');
$this->mapper
->expects($this
->at(0))
->method('getPendingUserIds')
->with(FALSE)
->willReturn([
1,
2,
3,
]);
$rid = 'authenticated';
$value = $this->forcePasswordChangeService
->getPendingUsersForRole($rid);
$this
->assertCount(3, $value, 'The correct number of pending users was returned for the authenticated role');
$this->mapper
->expects($this
->at(0))
->method('getPendingUserIds')
->with('admin')
->willReturn([
1,
2,
3,
4,
]);
$rid = 'admin';
$value = $this->forcePasswordChangeService
->getPendingUsersForRole($rid);
$this
->assertCount(4, $value, 'The correct number of pending users was returned for the admin role');
}