function UserTest::createAnotherEntity

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::createAnotherEntity()
  2. 10 core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::createAnotherEntity()
  3. 11.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::createAnotherEntity()

Overrides ResourceTestBase::createAnotherEntity

5 calls to UserTest::createAnotherEntity()
UserTest::testDeleteRespectsUserCancelBlock in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block.
UserTest::testDeleteRespectsUserCancelBlockUnpublish in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish.
UserTest::testDeleteRespectsUserCancelBlockUnpublishAndProcessesBatches in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_block_unpublish. @group jsonapi
UserTest::testDeleteRespectsUserCancelDelete in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_delete.
UserTest::testDeleteRespectsUserCancelReassign in core/modules/jsonapi/tests/src/Functional/UserTest.php
Tests if JSON:API respects user.settings.cancel_method: user_cancel_reassign.

File

core/modules/jsonapi/tests/src/Functional/UserTest.php, line 116

Class

UserTest
JSON:API integration test for the "User" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createAnotherEntity($key) {
    
    /** @var \Drupal\user\UserInterface $user */
    $user = $this->getEntityDuplicate($this->entity, $key);
    $user->setUsername($user->label() . '_' . $key);
    $user->setEmail("{$key}@example.com");
    $user->save();
    return $user;
}

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