function UserLegacyTest::testUserDelete

Tests that user_delete throws a deprecation error.

@expectedDeprecation user_delete() is deprecated in drupal:8.8.0. Use the user entity's delete method to delete the user. See https://www.drupal.org/node/3051463

File

core/modules/user/tests/src/Kernel/UserLegacyTest.php, line 68

Class

UserLegacyTest
Tests legacy user functionality.

Namespace

Drupal\Tests\user\Kernel

Code

public function testUserDelete() {
    User::create([
        'name' => 'foo',
        'uid' => 10,
    ])->save();
    user_delete(10);
    $this->assert(NULL === User::load(10), "User has been deleted");
}

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