function NodeOperationAccessTest::testNodeAccessControlHandlerDeprecation

Tests NodeAccessControlHandler deprecation.

@group legacy

File

core/modules/node/tests/src/Unit/NodeOperationAccessTest.php, line 282

Class

NodeOperationAccessTest
Tests node operations.

Namespace

Drupal\Tests\node\Unit

Code

public function testNodeAccessControlHandlerDeprecation() {
    $entity_type = $this->prophesize(EntityTypeInterface::class);
    $entity_type->id()
        ->willReturn(mt_rand(1, 128));
    $node_grant_storage = $this->prophesize(NodeGrantDatabaseStorageInterface::class);
    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
    $container = $this->prophesize(ContainerInterface::class);
    $container->get('entity_type.manager')
        ->willReturn($entity_type_manager->reveal());
    \Drupal::setContainer($container->reveal());
    $this->expectDeprecation('Calling Drupal\\node\\NodeAccessControlHandler::__construct() without the $entity_type_manager argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3214171');
    new NodeAccessControlHandler($entity_type->reveal(), $node_grant_storage->reveal());
}

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