You are here

public function EntityConverterTest::testDeprecatedLanguageManagerMethod in Drupal 8

Tests that retrieving the language manager triggers a deprecation error.

@group legacy

@expectedDeprecation The property languageManager (language_manager service) is deprecated in Drupal\Core\ParamConverter\EntityConverter and will be removed before Drupal 9.0.0.

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php, line 177

Class

EntityConverterTest
@coversDefaultClass \Drupal\Core\ParamConverter\EntityConverter @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testDeprecatedLanguageManagerMethod() {
  $this
    ->setUpMocks([
    'language_manager' => $this
      ->createMock(LanguageManagerInterface::class),
  ]);
  $this->entityConverter = new EntityConverter($this->entityTypeManager, $this->entityRepository);
  $reflector = new \ReflectionMethod(EntityConverter::class, 'languageManager');
  $reflector
    ->setAccessible(TRUE);
  $this
    ->assertSame(\Drupal::service('language_manager'), $reflector
    ->invoke($this->entityConverter));
}