function EntityDeprecationTest::testCreateUserDeprecation

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityDeprecationTest.php \Drupal\KernelTests\Core\Entity\EntityDeprecationTest::testCreateUserDeprecation()

Tests deprecation of \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::createUser().

File

core/tests/Drupal/KernelTests/Core/Entity/EntityDeprecationTest.php, line 18

Class

EntityDeprecationTest
Tests the deprecations for the \Drupal\KernelTests\Core\Entity namespace.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testCreateUserDeprecation() : void {
  $this->expectDeprecation('Calling createUser() with $values as the first parameter is deprecated in drupal:10.1.0 and will be removed from drupal:11.0.0. Use createUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = []) instead. See https://www.drupal.org/node/3330762');
  $this->createUser([
    'uid' => 2,
  ]);
  $this->expectDeprecation('Calling createUser() with $permissions as the second parameter is deprecated in drupal:10.1.0 and will be removed from drupal:11.0.0. Use createUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = []) instead. See https://www.drupal.org/node/3330762');
  $this->createUser([], [
    'administer entity_test content',
  ]);
}

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