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 account'.
$account = $this->createUser([], 'extra_user');
// Assert that this user account exists.
$this->assertEquals('extra_user', $account->getAccountName());
// Assert that the logged-in account is not the one stored in $account.
$this->assertNotEquals($this->owner
->getAccountName(), $account->getAccountName());
}