public function SimpleFbConnectUserManagerTest::testGenerateUniqueUsernameWithNoConflicts in Simple FB Connect 8.3
Same name and namespace in other branches
- 8.2 tests/src/Unit/SimpleFbConnectUserManagerTest.php \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectUserManagerTest::testGenerateUniqueUsernameWithNoConflicts()
Tests the generateUniqueUsername() when there is no conflicting username.
@covers ::generateUniqueUsername @covers ::loadUserByProperty
@dataProvider generateUniqueUsernameWithNoConflictsDataProvider
File
- tests/
src/ Unit/ SimpleFbConnectUserManagerTest.php, line 287
Class
- SimpleFbConnectUserManagerTest
- @coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectUserManager @group simple_fb_connect
Namespace
Drupal\Tests\simple_fb_connect\UnitCode
public function testGenerateUniqueUsernameWithNoConflicts($fb_name, $expected) {
$storage = $this
->getMockBuilder('Drupal\\Core\\Entity\\EntityStorageInterface')
->getMock();
$storage
->expects($this
->once())
->method('loadByProperties')
->willReturn([]);
$this->entityTypeManager
->expects($this
->once())
->method('getStorage')
->with('user')
->willReturn($storage);
$this
->assertEquals($expected, $this->userManager
->subGenerateUniqueUsername($fb_name));
}