public function UserLegacyTest::testUserDelete in Drupal 8
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\KernelCode
public function testUserDelete() {
  User::create([
    'name' => 'foo',
    'uid' => 10,
  ])
    ->save();
  user_delete(10);
  $this
    ->assert(NULL === User::load(10), "User has been deleted");
}