You are here

public function UserRegistrationResourceTest::testExistedEntityPost in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Unit/UserRegistrationResourceTest.php \Drupal\Tests\user\Unit\UserRegistrationResourceTest::testExistedEntityPost()

Tests that only new user accounts can be registered.

File

core/modules/user/tests/src/Unit/UserRegistrationResourceTest.php, line 87

Class

UserRegistrationResourceTest
Tests User Registration REST resource.

Namespace

Drupal\Tests\user\Unit

Code

public function testExistedEntityPost() {
  $entity = $this
    ->prophesize(User::class);
  $entity
    ->isNew()
    ->willReturn(FALSE);
  $this
    ->expectException(BadRequestHttpException::class);
  $this->testClass
    ->post($entity
    ->reveal());
}