function UserRequirementsTest::testAnonymousUser
Same name in other branches
- 11.x core/modules/user/tests/src/Functional/UserRequirementsTest.php \Drupal\Tests\user\Functional\UserRequirementsTest::testAnonymousUser()
Tests that the requirements check can detect a missing anonymous user.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserRequirementsTest.php, line 24
Class
- UserRequirementsTest
- Tests the requirements checks of the User module.
Namespace
Drupal\Tests\user\FunctionalCode
public function testAnonymousUser() : void {
// Remove the anonymous user.
\Drupal::database()->delete('users')
->condition('uid', 0)
->execute();
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
$this->drupalGet('/admin/reports/status');
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains("The anonymous user does not exist.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.