function ExampleFixtureManagementTest::testUserCreation
Create a user account using createUser() from the UserCreation trait.
File
-
modules/
testing_example/ tests/ src/ Kernel/ ExampleFixtureManagementTest.php, line 111
Class
- ExampleFixtureManagementTest
- Demonstrate manipulating fixture data in a kernel test.
Namespace
Drupal\Tests\testing_example\KernelCode
public function testUserCreation() {
// Create a user named 'extrauser'.
$account = $this->createUser([], 'extrauser');
// Assert that this user exists.
$this->assertEquals('extrauser', $account->getAccountName());
// Assert that our auth user is not the same user as extrauser.
$this->assertNotEquals($this->owner
->getAccountName(), $account->getAccountName());
}