function DeprecatedClassesTest::assertDeprecatedConstructorParameter
Test that deprecation for the \Drupal\Core\Path\AliasManagerInterface.
@dataProvider deprecatedConstructorParametersProvider
@expectedDeprecation The \Drupal\Core\Path\AliasManagerInterface interface is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\AliasManagerInterface. See https://drupal.org/node/3092086
Parameters
string $tested_class_name: The name of the tested class.
3 calls to DeprecatedClassesTest::assertDeprecatedConstructorParameter()
- DeprecatedClassesTest::testDeprecatedRawConstructorParameters in core/
modules/ path_alias/ tests/ src/ Unit/ DeprecatedClassesTest.php - @covers \Drupal\views\Plugin\views\argument_default\Raw::__construct
- DeprecatedClassesTest::testDeprecatedRequestPathConstructorParameters in core/
modules/ path_alias/ tests/ src/ Unit/ DeprecatedClassesTest.php - @covers \Drupal\system\Plugin\Condition\RequestPath::__construct
- DeprecatedClassesTest::testDeprecatedSystemInformationFormConstructorParameters in core/
modules/ path_alias/ tests/ src/ Unit/ DeprecatedClassesTest.php - @covers \Drupal\system\Form\SiteInformationForm::__construct
File
-
core/
modules/ path_alias/ tests/ src/ Unit/ DeprecatedClassesTest.php, line 211
Class
- DeprecatedClassesTest
- Tests deprecation of path alias core service classes.
Namespace
Drupal\Tests\path_alias\UnitCode
public function assertDeprecatedConstructorParameter($tested_class_name) {
$tested_class = new \ReflectionClass($tested_class_name);
$parameters = $tested_class->getConstructor()
->getParameters();
$args = [];
foreach ($parameters as $parameter) {
$name = $parameter->getName();
if ($name === 'alias_manager') {
$class_name = CoreAliasManagerInterface::class;
}
else {
$type = $parameter->getType();
$class_name = $type ? (string) $type : NULL;
}
$args[$name] = isset($class_name) && $class_name !== 'array' ? $this->prophesize($class_name)
->reveal() : [];
}
$instance = $tested_class->newInstanceArgs($args);
$property = $tested_class->getProperty('aliasManager');
$property->setAccessible(TRUE);
$this->assertInstanceOf(AliasManagerInterface::class, $property->getValue($instance));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.