function UserRegistrationResourceTest::testDeprecations
Tests the deprecation messages.
@covers ::__construct
@group legacy
File
-
core/
modules/ user/ tests/ src/ Unit/ UserRegistrationResourceTest.php, line 150
Class
- UserRegistrationResourceTest
- Tests User Registration REST resource.
Namespace
Drupal\Tests\user\UnitCode
public function testDeprecations() : void {
$this->expectDeprecation('Calling Drupal\\user\\Plugin\\rest\\resource\\UserRegistrationResource::__construct() without the $password_generator argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3405799');
$this->expectException(BadRequestHttpException::class);
$container = new ContainerBuilder();
$password_generator = $this->prophesize(PasswordGeneratorInterface::class);
$container->set('password_generator', $password_generator->reveal());
\Drupal::setContainer($container);
$this->testClass = new UserRegistrationResource([], 'plugin_id', '', [], $this->logger, $this->userSettings
->reveal(), $this->currentUser
->reveal());
$this->testClass
->post(NULL);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.