public function UserCancelTest::testUserDeleteWithContentAndNodeAccess in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Functional/UserCancelTest.php \Drupal\Tests\user\Functional\UserCancelTest::testUserDeleteWithContentAndNodeAccess()
Tests user cancel with node access.
File
- core/
modules/ user/ tests/ src/ Functional/ UserCancelTest.php, line 655
Class
- UserCancelTest
- Ensure that account cancellation methods work as expected.
Namespace
Drupal\Tests\user\FunctionalCode
public function testUserDeleteWithContentAndNodeAccess() {
\Drupal::service('module_installer')
->install([
'node_access_test',
]);
// Rebuild node access.
node_access_rebuild();
$account = $this
->drupalCreateUser([
'access content',
]);
$node = $this
->drupalCreateNode([
'type' => 'page',
'uid' => $account
->id(),
]);
$account
->delete();
$load2 = \Drupal::entityTypeManager()
->getStorage('node')
->load($node
->id());
$this
->assertTrue(empty($load2));
}