function UserCancelTest::testUserDeleteWithContentAndNodeAccess

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserCancelTest.php \Drupal\Tests\user\Functional\UserCancelTest::testUserDeleteWithContentAndNodeAccess()
  2. 10 core/modules/user/tests/src/Functional/UserCancelTest.php \Drupal\Tests\user\Functional\UserCancelTest::testUserDeleteWithContentAndNodeAccess()
  3. 11.x 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 598

Class

UserCancelTest
Ensure that account cancellation methods work as expected.

Namespace

Drupal\Tests\user\Functional

Code

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.