diff --git a/core/core.api.php b/core/core.api.php index b597f5d96b2..66352cd8f34 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -761,9 +761,9 @@ * * A typical service definition in a *.services.yml file looks like this: * @code - * path.alias_manager: + * path_alias.manager: * class: Drupal\path_alias\AliasManager - * arguments: ['@path.crud', '@path_alias.whitelist', '@language_manager'] + * arguments: ['@path_alias.repository', '@path_alias.whitelist', '@language_manager'] * @endcode * Some services use other services as factories; a typical service definition * is: diff --git a/core/core.services.yml b/core/core.services.yml index c9062d5397c..3398dd955a3 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1218,7 +1218,7 @@ services: - { name: event_subscriber } path_subscriber: class: Drupal\Core\EventSubscriber\PathSubscriber - arguments: ['@path.alias_manager', '@path.current'] + arguments: ['@path_alias.manager', '@path.current'] deprecated: 'The "%service_id%" service is deprecated. Use "path_alias.subscriber" instead. See https://drupal.org/node/3092086' route_access_response_subscriber: class: Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber @@ -1352,7 +1352,7 @@ services: - { name: route_processor_outbound, priority: 200 } path_processor_alias: class: Drupal\Core\PathProcessor\PathProcessorAlias - arguments: ['@path.alias_manager'] + arguments: ['@path_alias.manager'] deprecated: 'The "%service_id%" service is deprecated. Use "path_alias.path_processor" instead. See https://drupal.org/node/3092086' route_processor_csrf: class: Drupal\Core\Access\RouteProcessorCsrf diff --git a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php index f25bc49b4ac..8af50984760 100644 --- a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php @@ -12,10 +12,10 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Provides a path subscriber that converts path aliases. * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. - * Use \Drupal\path_alias\EventSubscriber\PathAliasSubscriber. + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\path_alias\EventSubscriber\PathAliasSubscriber instead. * - * @see https://www.drupal.org/node/3092086 + * @see https://www.drupal.org/node/3092086 */ class PathSubscriber implements EventSubscriberInterface { diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php index 4c95089369f..5673f6627be 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -12,10 +12,10 @@ use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceExce /** * The default alias manager implementation. * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. - * Use \Drupal\path_alias\AliasManager. + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\path_alias\AliasManager instead. * - * @see https://www.drupal.org/node/3092086 + * @see https://www.drupal.org/node/3092086 */ class AliasManager implements AliasManagerInterface, CacheDecoratorInterface { diff --git a/core/lib/Drupal/Core/Path/AliasRepository.php b/core/lib/Drupal/Core/Path/AliasRepository.php index 7c28161fdfc..d6f3717b765 100644 --- a/core/lib/Drupal/Core/Path/AliasRepository.php +++ b/core/lib/Drupal/Core/Path/AliasRepository.php @@ -10,10 +10,10 @@ use Drupal\Core\Language\LanguageInterface; /** * Provides the default path alias lookup operations. * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. - * Use \Drupal\path_alias\AliasRepository. + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\path_alias\AliasRepository instead. * - * @see https://www.drupal.org/node/3092086 + * @see https://www.drupal.org/node/3092086 */ class AliasRepository implements AliasRepositoryInterface { diff --git a/core/lib/Drupal/Core/Path/AliasWhitelist.php b/core/lib/Drupal/Core/Path/AliasWhitelist.php index ff6c193f67d..79f2ba6dc62 100644 --- a/core/lib/Drupal/Core/Path/AliasWhitelist.php +++ b/core/lib/Drupal/Core/Path/AliasWhitelist.php @@ -11,10 +11,10 @@ use Drupal\Core\Lock\LockBackendInterface; /** * Extends CacheCollector to build the path alias whitelist over time. * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. - * Use \Drupal\path_alias\AliasWhitelist. + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\path_alias\AliasWhitelist instead. * - * @see https://www.drupal.org/node/3092086 + * @see https://www.drupal.org/node/3092086 */ class AliasWhitelist extends CacheCollector implements AliasWhitelistInterface { diff --git a/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php b/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php index de7f29c6a70..bae2028f323 100644 --- a/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php +++ b/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php @@ -9,10 +9,10 @@ use Symfony\Component\HttpFoundation\Request; /** * Processes the inbound path using path alias lookups. * - * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. - * Use \Drupal\path_alias\PathProcessor\AliasPathProcessor. + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\path_alias\PathProcessor\AliasPathProcessor. * - * @see https://www.drupal.org/node/3092086 + * @see https://www.drupal.org/node/3092086 */ class PathProcessorAlias implements InboundPathProcessorInterface, OutboundPathProcessorInterface { diff --git a/core/modules/locale/tests/src/Functional/LocalePathTest.php b/core/modules/locale/tests/src/Functional/LocalePathTest.php index 9b1584e4468..036b9574701 100644 --- a/core/modules/locale/tests/src/Functional/LocalePathTest.php +++ b/core/modules/locale/tests/src/Functional/LocalePathTest.php @@ -106,10 +106,10 @@ class LocalePathTest extends BrowserTestBase { // Check priority of language for alias by source path. $path_alias = $this->createPathAlias('/node/' . $node->id(), '/' . $custom_path, LanguageInterface::LANGCODE_NOT_SPECIFIED); - $lookup_path = $this->container->get('path.alias_manager')->getAliasByPath('/node/' . $node->id(), 'en'); + $lookup_path = $this->container->get('path_alias.manager')->getAliasByPath('/node/' . $node->id(), 'en'); $this->assertEqual('/' . $english_path, $lookup_path, 'English language alias has priority.'); // Same check for language 'xx'. - $lookup_path = $this->container->get('path.alias_manager')->getAliasByPath('/node/' . $node->id(), $prefix); + $lookup_path = $this->container->get('path_alias.manager')->getAliasByPath('/node/' . $node->id(), $prefix); $this->assertEqual('/' . $custom_language_path, $lookup_path, 'Custom language alias has priority.'); $path_alias->delete(); diff --git a/core/modules/path/src/PathAliasListBuilder.php b/core/modules/path/src/PathAliasListBuilder.php index 0d6dc539e7e..4c6ca4622c3 100644 --- a/core/modules/path/src/PathAliasListBuilder.php +++ b/core/modules/path/src/PathAliasListBuilder.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Language\LanguageManagerInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\Url; use Drupal\path\Form\PathFilterForm; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request; /** * Defines a class to build a listing of path_alias entities. * - * @see \Drupal\Core\Path\Entity\PathAlias + * @see \Drupal\path_alias\Entity\PathAlias */ class PathAliasListBuilder extends EntityListBuilder { @@ -46,7 +46,7 @@ class PathAliasListBuilder extends EntityListBuilder { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -63,7 +63,7 @@ class PathAliasListBuilder extends EntityListBuilder { * The form builder. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path_alias\AliasManagerInterface $alias_manager * The path alias manager. */ public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, Request $current_request, FormBuilderInterface $form_builder, LanguageManagerInterface $language_manager, AliasManagerInterface $alias_manager) { @@ -85,7 +85,7 @@ class PathAliasListBuilder extends EntityListBuilder { $container->get('request_stack')->getCurrentRequest(), $container->get('form_builder'), $container->get('language_manager'), - $container->get('path.alias_manager') + $container->get('path_alias.manager') ); } diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php index a791d7afeb0..0836df17abc 100644 --- a/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php +++ b/core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php @@ -26,7 +26,7 @@ class PathFieldItemList extends FieldItemList { $entity = $this->getEntity(); if (!$entity->isNew()) { - /** @var \Drupal\Core\Path\AliasRepositoryInterface $path_alias_repository */ + /** @var \Drupal\path_alias\AliasRepositoryInterface $path_alias_repository */ $path_alias_repository = \Drupal::service('path_alias.repository'); if ($path_alias = $path_alias_repository->lookupBySystemPath('/' . $entity->toUrl()->getInternalPath(), $this->getLangcode())) { diff --git a/core/modules/path/src/Plugin/migrate/source/UrlAliasBase.php b/core/modules/path/src/Plugin/migrate/source/UrlAliasBase.php index b2e7e0d758a..79e6400355f 100644 --- a/core/modules/path/src/Plugin/migrate/source/UrlAliasBase.php +++ b/core/modules/path/src/Plugin/migrate/source/UrlAliasBase.php @@ -14,9 +14,9 @@ abstract class UrlAliasBase extends DrupalSqlBase { */ public function query() { // The order of the migration is significant since - // \Drupal\Core\Path\AliasRepository::lookupPathAlias() orders by pid before - // returning a result. Postgres does not automatically order by primary key - // therefore we need to add a specific order by. + // \Drupal\path_alias\AliasRepository::lookupPathAlias() orders by pid + // before returning a result. Postgres does not automatically order by + // primary key therefore we need to add a specific order by. return $this->select('url_alias', 'ua')->fields('ua')->orderBy('pid'); } diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php index 54c200873dc..0ef6b99304b 100644 --- a/core/modules/path/tests/src/Functional/PathAliasTest.php +++ b/core/modules/path/tests/src/Functional/PathAliasTest.php @@ -120,7 +120,7 @@ class PathAliasTest extends PathTestBase { $this->assertText($node1->label(), 'Changed alias works.'); $this->assertResponse(200); - $this->container->get('path.alias_manager')->cacheClear(); + $this->container->get('path_alias.manager')->cacheClear(); // Confirm that previous alias no longer works. $this->drupalGet($previous); $this->assertNoText($node1->label(), 'Previous alias no longer works.'); diff --git a/core/modules/path/tests/src/Functional/PathLanguageTest.php b/core/modules/path/tests/src/Functional/PathLanguageTest.php index 7f2167108cb..a5982e15d8b 100644 --- a/core/modules/path/tests/src/Functional/PathLanguageTest.php +++ b/core/modules/path/tests/src/Functional/PathLanguageTest.php @@ -101,7 +101,7 @@ class PathLanguageTest extends PathTestBase { $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); // Clear the path lookup cache. - $this->container->get('path.alias_manager')->cacheClear(); + $this->container->get('path_alias.manager')->cacheClear(); // Languages are cached on many levels, and we need to clear those caches. $this->container->get('language_manager')->reset(); @@ -172,18 +172,18 @@ class PathLanguageTest extends PathTestBase { // The alias manager has an internal path lookup cache. Check to see that // it has the appropriate contents at this point. - $this->container->get('path.alias_manager')->cacheClear(); - $french_node_path = $this->container->get('path.alias_manager')->getPathByAlias('/' . $french_alias, 'fr'); + $this->container->get('path_alias.manager')->cacheClear(); + $french_node_path = $this->container->get('path_alias.manager')->getPathByAlias('/' . $french_alias, 'fr'); $this->assertEqual($french_node_path, '/node/' . $english_node_french_translation->id(), 'Normal path works.'); // Second call should return the same path. - $french_node_path = $this->container->get('path.alias_manager')->getPathByAlias('/' . $french_alias, 'fr'); + $french_node_path = $this->container->get('path_alias.manager')->getPathByAlias('/' . $french_alias, 'fr'); $this->assertEqual($french_node_path, '/node/' . $english_node_french_translation->id(), 'Normal path is the same.'); // Confirm that the alias works. - $french_node_alias = $this->container->get('path.alias_manager')->getAliasByPath('/node/' . $english_node_french_translation->id(), 'fr'); + $french_node_alias = $this->container->get('path_alias.manager')->getAliasByPath('/node/' . $english_node_french_translation->id(), 'fr'); $this->assertEqual($french_node_alias, '/' . $french_alias, 'Alias works.'); // Second call should return the same alias. - $french_node_alias = $this->container->get('path.alias_manager')->getAliasByPath('/node/' . $english_node_french_translation->id(), 'fr'); + $french_node_alias = $this->container->get('path_alias.manager')->getAliasByPath('/node/' . $english_node_french_translation->id(), 'fr'); $this->assertEqual($french_node_alias, '/' . $french_alias, 'Alias is the same.'); // Confirm that the alias is removed if the translation is deleted. diff --git a/core/modules/path/tests/src/Kernel/PathItemTest.php b/core/modules/path/tests/src/Kernel/PathItemTest.php index 3398116d454..240b6cf54a7 100644 --- a/core/modules/path/tests/src/Kernel/PathItemTest.php +++ b/core/modules/path/tests/src/Kernel/PathItemTest.php @@ -44,7 +44,7 @@ class PathItemTest extends KernelTestBase { * Test creating, loading, updating and deleting aliases through PathItem. */ public function testPathItem() { - /** @var \Drupal\Core\Path\AliasRepositoryInterface $alias_repository */ + /** @var \Drupal\path_alias\AliasRepositoryInterface $alias_repository */ $alias_repository = \Drupal::service('path_alias.repository'); $node_storage = \Drupal::entityTypeManager()->getStorage('node'); diff --git a/core/modules/path_alias/src/Entity/PathAlias.php b/core/modules/path_alias/src/Entity/PathAlias.php index 209d160d546..aabbaaff1e1 100644 --- a/core/modules/path_alias/src/Entity/PathAlias.php +++ b/core/modules/path_alias/src/Entity/PathAlias.php @@ -106,7 +106,7 @@ class PathAlias extends ContentEntityBase implements PathAliasInterface { public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); - $alias_manager = \Drupal::service('path.alias_manager'); + $alias_manager = \Drupal::service('path_alias.manager'); $alias_manager->cacheClear($this->getPath()); if ($update) { $alias_manager->cacheClear($this->original->getPath()); @@ -119,7 +119,7 @@ class PathAlias extends ContentEntityBase implements PathAliasInterface { public static function postDelete(EntityStorageInterface $storage, array $entities) { parent::postDelete($storage, $entities); - $alias_manager = \Drupal::service('path.alias_manager'); + $alias_manager = \Drupal::service('path_alias.manager'); foreach ($entities as $entity) { $alias_manager->cacheClear($entity->getPath()); } diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php index 800c8e86c98..42f789db28e 100644 --- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php @@ -119,7 +119,7 @@ class UrlAlterFunctionalTest extends BrowserTestBase { */ protected function assertUrlInboundAlter($original, $final) { // Test inbound altering. - $result = $this->container->get('path.alias_manager')->getPathByAlias($original); + $result = $this->container->get('path_alias.manager')->getPathByAlias($original); return $this->assertIdentical($result, $final, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); } diff --git a/core/modules/path_alias/tests/src/Kernel/AliasTest.php b/core/modules/path_alias/tests/src/Kernel/AliasTest.php index b9c3cc358e0..083a4cc2c85 100644 --- a/core/modules/path_alias/tests/src/Kernel/AliasTest.php +++ b/core/modules/path_alias/tests/src/Kernel/AliasTest.php @@ -12,7 +12,7 @@ use Drupal\Tests\Traits\Core\PathAliasTestTrait; /** * Tests path alias CRUD and lookup functionality. * - * @coversDefaultClass \Drupal\Core\Path\AliasRepository + * @coversDefaultClass \Drupal\path_alias\AliasRepository * * @group path_alias */ @@ -61,12 +61,12 @@ class AliasTest extends KernelTestBase { } /** - * @covers \Drupal\Core\Path\AliasManager::getPathByAlias - * @covers \Drupal\Core\Path\AliasManager::getAliasByPath + * @covers \Drupal\path_alias\AliasManager::getPathByAlias + * @covers \Drupal\path_alias\AliasManager::getAliasByPath */ public function testLookupPath() { // Create AliasManager and Path object. - $aliasManager = $this->container->get('path.alias_manager'); + $aliasManager = $this->container->get('path_alias.manager'); // Test the situation where the source is the same for multiple aliases. // Start with a language-neutral alias, which we will override. diff --git a/core/modules/path_alias/tests/src/Kernel/PathHooksTest.php b/core/modules/path_alias/tests/src/Kernel/PathHooksTest.php index 2a7b8674317..80e2683a409 100644 --- a/core/modules/path_alias/tests/src/Kernel/PathHooksTest.php +++ b/core/modules/path_alias/tests/src/Kernel/PathHooksTest.php @@ -45,7 +45,7 @@ class PathHooksTest extends KernelTestBase { $alias_manager = $this->prophesize(AliasManagerInterface::class); $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1); $alias_manager->cacheClear($path_alias->getPath())->shouldBeCalledTimes(1); - \Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal()); + \Drupal::getContainer()->set('path_alias.manager', $alias_manager->reveal()); $path_alias->save(); $new_source = '/' . $this->randomMachineName(); @@ -56,7 +56,7 @@ class PathHooksTest extends KernelTestBase { $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(2); $alias_manager->cacheClear($path_alias->getPath())->shouldBeCalledTimes(1); $alias_manager->cacheClear($new_source)->shouldBeCalledTimes(1); - \Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal()); + \Drupal::getContainer()->set('path_alias.manager', $alias_manager->reveal()); $path_alias->setPath($new_source); $path_alias->save(); @@ -64,7 +64,7 @@ class PathHooksTest extends KernelTestBase { $alias_manager = $this->prophesize(AliasManagerInterface::class); $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1); $alias_manager->cacheClear($new_source)->shouldBeCalledTimes(1); - \Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal()); + \Drupal::getContainer()->set('path_alias.manager', $alias_manager->reveal()); $path_alias->delete(); } diff --git a/core/modules/path_alias/tests/src/Unit/AliasManagerTest.php b/core/modules/path_alias/tests/src/Unit/AliasManagerTest.php index c0b767480eb..e260fb6834a 100644 --- a/core/modules/path_alias/tests/src/Unit/AliasManagerTest.php +++ b/core/modules/path_alias/tests/src/Unit/AliasManagerTest.php @@ -4,7 +4,7 @@ namespace Drupal\Tests\path_alias\Unit; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Path\AliasRepositoryInterface; +use Drupal\path_alias\AliasRepositoryInterface; use Drupal\path_alias\AliasManager; use Drupal\Tests\UnitTestCase; @@ -31,7 +31,7 @@ class AliasManagerTest extends UnitTestCase { /** * Alias repository. * - * @var \Drupal\Core\Path\AliasRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Drupal\path_alias\AliasRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $aliasRepository; diff --git a/core/modules/path_alias/tests/src/Unit/DeprecatedClassesTest.php b/core/modules/path_alias/tests/src/Unit/DeprecatedClassesTest.php index 8ac7df49d36..347e7781903 100644 --- a/core/modules/path_alias/tests/src/Unit/DeprecatedClassesTest.php +++ b/core/modules/path_alias/tests/src/Unit/DeprecatedClassesTest.php @@ -8,6 +8,7 @@ use Drupal\Core\EventSubscriber\PathSubscriber; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Path\AliasManager as CoreAliasManager; +use Drupal\Core\Path\AliasManagerInterface as CoreAliasManagerInterface; use Drupal\Core\Path\AliasWhitelist as CoreAliasWhitelist; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\PathProcessor\PathProcessorAlias; @@ -19,7 +20,10 @@ use Drupal\path_alias\AliasWhitelist; use Drupal\path_alias\AliasWhitelistInterface; use Drupal\path_alias\EventSubscriber\PathAliasSubscriber; use Drupal\path_alias\PathProcessor\AliasPathProcessor; +use Drupal\system\Form\SiteInformationForm; +use Drupal\system\Plugin\Condition\RequestPath; use Drupal\Tests\UnitTestCase; +use Drupal\views\Plugin\views\argument_default\Raw; /** * Tests deprecation of path alias core service classes. @@ -167,4 +171,65 @@ class DeprecatedClassesTest extends UnitTestCase { $this->assertInstanceOf(CoreAliasWhitelist::class, $object); } + /** + * @covers \Drupal\system\Form\SiteInformationForm::__construct + * + * @expectedDeprecation Calling \Drupal\system\Form\SiteInformationForm::__construct with \Drupal\Core\Path\AliasManagerInterface instead of \Drupal\path_alias\AliasManagerInterface is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086 + */ + public function testDeprecatedSystemInformationFormConstructorParameters() { + $this->assertDeprecatedConstructorParameter(SiteInformationForm::class); + } + + /** + * @covers \Drupal\system\Plugin\Condition\RequestPath::__construct + * + * @expectedDeprecation Calling \Drupal\system\Plugin\Condition\RequestPath::__construct with \Drupal\Core\Path\AliasManagerInterface instead of \Drupal\path_alias\AliasManagerInterface is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086 + */ + public function testDeprecatedRequestPathConstructorParameters() { + $this->assertDeprecatedConstructorParameter(RequestPath::class); + } + + /** + * @covers \Drupal\views\Plugin\views\argument_default\Raw::__construct + * + * @expectedDeprecation Calling \Drupal\views\Plugin\views\argument_default\Raw::__construct with \Drupal\Core\Path\AliasManagerInterface instead of \Drupal\path_alias\AliasManagerInterface is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086 + */ + public function testDeprecatedRawConstructorParameters() { + $this->assertDeprecatedConstructorParameter(Raw::class); + } + + /** + * Test that deprecation for the \Drupal\Core\Path\AliasManagerInterface. + * + * @param string $tested_class_name + * The name of the tested class. + * + * @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 + */ + 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 ? $type->getName() : 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)); + } + } diff --git a/core/modules/system/src/Form/SiteInformationForm.php b/core/modules/system/src/Form/SiteInformationForm.php index 4e4e1571fd5..c4d95b53de7 100644 --- a/core/modules/system/src/Form/SiteInformationForm.php +++ b/core/modules/system/src/Form/SiteInformationForm.php @@ -3,11 +3,12 @@ namespace Drupal\system\Form; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; use Drupal\Core\Form\ConfigFormBase; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Path\AliasManagerInterface as CoreAliasManagerInterface; use Drupal\Core\Path\PathValidatorInterface; use Drupal\Core\Routing\RequestContext; +use Drupal\path_alias\AliasManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -20,7 +21,7 @@ class SiteInformationForm extends ConfigFormBase { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -43,16 +44,21 @@ class SiteInformationForm extends ConfigFormBase { * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path_alias\AliasManagerInterface $alias_manager * The path alias manager. * @param \Drupal\Core\Path\PathValidatorInterface $path_validator * The path validator. * @param \Drupal\Core\Routing\RequestContext $request_context * The request context. */ - public function __construct(ConfigFactoryInterface $config_factory, AliasManagerInterface $alias_manager, PathValidatorInterface $path_validator, RequestContext $request_context) { + public function __construct(ConfigFactoryInterface $config_factory, $alias_manager, PathValidatorInterface $path_validator, RequestContext $request_context) { parent::__construct($config_factory); + if (!$alias_manager instanceof AliasManagerInterface) { + @trigger_error('Calling \\' . __METHOD__ . ' with \\' . CoreAliasManagerInterface::class . ' instead of \\' . AliasManagerInterface::class . ' is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086', E_USER_DEPRECATED); + $alias_manager = \Drupal::service('path_alias.manager'); + } + $this->aliasManager = $alias_manager; $this->pathValidator = $path_validator; $this->requestContext = $request_context; @@ -64,7 +70,7 @@ class SiteInformationForm extends ConfigFormBase { public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), - $container->get('path.alias_manager'), + $container->get('path_alias.manager'), $container->get('path.validator'), $container->get('router.request_context') ); diff --git a/core/modules/system/src/Plugin/Condition/RequestPath.php b/core/modules/system/src/Plugin/Condition/RequestPath.php index 1f73624774b..38dc216ca11 100644 --- a/core/modules/system/src/Plugin/Condition/RequestPath.php +++ b/core/modules/system/src/Plugin/Condition/RequestPath.php @@ -4,10 +4,11 @@ namespace Drupal\system\Plugin\Condition; use Drupal\Core\Condition\ConditionPluginBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\Path\AliasManagerInterface as CoreAliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\PathMatcherInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\path_alias\AliasManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; @@ -24,7 +25,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI /** * An alias manager to find the alias for the current system path. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -52,7 +53,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI /** * Constructs a RequestPath condition plugin. * - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path_alias\AliasManagerInterface $alias_manager * An alias manager to find the alias for the current system path. * @param \Drupal\Core\Path\PathMatcherInterface $path_matcher * The path matcher service. @@ -67,8 +68,14 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI * @param array $plugin_definition * The plugin implementation definition. */ - public function __construct(AliasManagerInterface $alias_manager, PathMatcherInterface $path_matcher, RequestStack $request_stack, CurrentPathStack $current_path, array $configuration, $plugin_id, array $plugin_definition) { + public function __construct($alias_manager, PathMatcherInterface $path_matcher, RequestStack $request_stack, CurrentPathStack $current_path, array $configuration, $plugin_id, array $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); + + if (!$alias_manager instanceof AliasManagerInterface) { + @trigger_error('Calling \\' . __METHOD__ . ' with \\' . CoreAliasManagerInterface::class . ' instead of \\' . AliasManagerInterface::class . ' is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086', E_USER_DEPRECATED); + $alias_manager = \Drupal::service('path_alias.manager'); + } + $this->aliasManager = $alias_manager; $this->pathMatcher = $path_matcher; $this->requestStack = $request_stack; @@ -80,7 +87,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( - $container->get('path.alias_manager'), + $container->get('path_alias.manager'), $container->get('path.matcher'), $container->get('request_stack'), $container->get('path.current'), diff --git a/core/modules/system/src/Tests/Routing/MockAliasManager.php b/core/modules/system/src/Tests/Routing/MockAliasManager.php index 09f36366fc6..dcbfbe7162b 100644 --- a/core/modules/system/src/Tests/Routing/MockAliasManager.php +++ b/core/modules/system/src/Tests/Routing/MockAliasManager.php @@ -2,7 +2,7 @@ namespace Drupal\system\Tests\Routing; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; /** * An easily configurable mock alias manager. diff --git a/core/modules/views/src/Plugin/views/argument_default/Raw.php b/core/modules/views/src/Plugin/views/argument_default/Raw.php index 2491bd83c0d..048e37b9f91 100644 --- a/core/modules/views/src/Plugin/views/argument_default/Raw.php +++ b/core/modules/views/src/Plugin/views/argument_default/Raw.php @@ -5,8 +5,9 @@ namespace Drupal\views\Plugin\views\argument_default; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\Path\AliasManagerInterface as CoreAliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; +use Drupal\path_alias\AliasManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -24,7 +25,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf /** * The alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -44,14 +45,19 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path_alias\AliasManagerInterface $alias_manager * The alias manager. * @param \Drupal\Core\Path\CurrentPathStack $current_path * The current path. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, AliasManagerInterface $alias_manager, CurrentPathStack $current_path) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, $alias_manager, CurrentPathStack $current_path) { parent::__construct($configuration, $plugin_id, $plugin_definition); + if (!$alias_manager instanceof AliasManagerInterface) { + @trigger_error('Calling \\' . __METHOD__ . ' with \\' . CoreAliasManagerInterface::class . ' instead of \\' . AliasManagerInterface::class . ' is deprecated in drupal:8.8.0. The new service will be required in drupal:9.0.0. See https://www.drupal.org/node/3092086', E_USER_DEPRECATED); + $alias_manager = \Drupal::service('path_alias.manager'); + } + $this->aliasManager = $alias_manager; $this->currentPath = $current_path; } @@ -64,7 +70,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf $configuration, $plugin_id, $plugin_definition, - $container->get('path.alias_manager'), + $container->get('path_alias.manager'), $container->get('path.current') ); } diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php index cc8f2c78df7..c3c7dd140d5 100644 --- a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Unit\Plugin\argument_default; use Drupal\Core\Path\CurrentPathStack; +use Drupal\path_alias\AliasManagerInterface; use Drupal\Tests\UnitTestCase; use Drupal\views\Plugin\views\argument_default\Raw; use Symfony\Component\HttpFoundation\Request; @@ -33,7 +34,7 @@ class RawTest extends UnitTestCase { $view->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)); - $alias_manager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $alias_manager = $this->createMock(AliasManagerInterface::class); $alias_manager->expects($this->never()) ->method('getAliasByPath'); @@ -71,7 +72,7 @@ class RawTest extends UnitTestCase { $this->assertEquals(NULL, $raw->getArgument()); // Setup an alias manager with a path alias. - $alias_manager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $alias_manager = $this->createMock(AliasManagerInterface::class); $alias_manager->expects($this->any()) ->method('getAliasByPath') ->with($this->equalTo('/test/example')) diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index dea9361b488..da5c0bb7e7b 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -323,7 +323,7 @@ function views_ui_views_analyze(ViewExecutable $view) { continue; } if ($display->hasPath() && $path = $display->getOption('path')) { - $normal_path = \Drupal::service('path.alias_manager')->getPathByAlias($path); + $normal_path = \Drupal::service('path_alias.manager')->getPathByAlias($path); if ($path != $normal_path) { $ret[] = Analyzer::formatMessage(t('You have configured display %display with a path which is an path alias as well. This might lead to unwanted effects so better use an internal path.', ['%display' => $display->display['display_title']]), 'warning'); } diff --git a/core/modules/workspaces/src/EventSubscriber/WorkspaceRequestSubscriber.php b/core/modules/workspaces/src/EventSubscriber/WorkspaceRequestSubscriber.php index e44d36b02ad..fdab25ecb7e 100644 --- a/core/modules/workspaces/src/EventSubscriber/WorkspaceRequestSubscriber.php +++ b/core/modules/workspaces/src/EventSubscriber/WorkspaceRequestSubscriber.php @@ -2,7 +2,7 @@ namespace Drupal\workspaces\EventSubscriber; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Routing\CacheableRouteProviderInterface; use Drupal\Core\Routing\RouteProviderInterface; @@ -20,7 +20,7 @@ class WorkspaceRequestSubscriber implements EventSubscriberInterface { /** * The alias manager that caches alias lookups based on the request. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -48,7 +48,7 @@ class WorkspaceRequestSubscriber implements EventSubscriberInterface { /** * Constructs a new WorkspaceRequestSubscriber instance. * - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path_alias\AliasManagerInterface $alias_manager * The alias manager. * @param \Drupal\Core\Path\CurrentPathStack $current_path * The current path. diff --git a/core/modules/workspaces/src/WorkspaceManager.php b/core/modules/workspaces/src/WorkspaceManager.php index 499c5cd786a..541ca88564a 100644 --- a/core/modules/workspaces/src/WorkspaceManager.php +++ b/core/modules/workspaces/src/WorkspaceManager.php @@ -265,7 +265,7 @@ class WorkspaceManager implements WorkspaceManagerInterface { // Clear the static cache for path aliases. We can't inject the path alias // manager service because it would create a circular dependency. - \Drupal::service('path.alias_manager')->cacheClear(); + \Drupal::service('path_alias.manager')->cacheClear(); } /** diff --git a/core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php b/core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php index e5f109832d0..3aba7fb2af5 100644 --- a/core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php +++ b/core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\workspaces\Unit; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Routing\CacheableRouteProviderInterface; use Drupal\Core\Routing\RouteProviderInterface; @@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent; class WorkspaceRequestSubscriberTest extends UnitTestCase { /** - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; diff --git a/core/modules/workspaces/workspaces.services.yml b/core/modules/workspaces/workspaces.services.yml index ee7b573beca..1db8c49ebff 100644 --- a/core/modules/workspaces/workspaces.services.yml +++ b/core/modules/workspaces/workspaces.services.yml @@ -40,7 +40,7 @@ services: - { name: 'event_subscriber' } workspaces.workspace_subscriber: class: Drupal\workspaces\EventSubscriber\WorkspaceRequestSubscriber - arguments: ['@path.alias_manager', '@path.current', '@router.route_provider', '@workspaces.manager'] + arguments: ['@path_alias.manager', '@path.current', '@router.route_provider', '@workspaces.manager'] tags: - { name: event_subscriber } diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index acd87a0ba9a..6835cc3bd02 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -8,7 +8,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\FileSystemInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\State\StateInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -23,7 +23,7 @@ class InstallHelper implements ContainerInjectionInterface { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; @@ -99,7 +99,7 @@ class InstallHelper implements ContainerInjectionInterface { /** * Constructs a new InstallHelper object. * - * @param \Drupal\Core\Path\AliasManagerInterface $aliasManager + * @param \Drupal\path_alias\AliasManagerInterface $aliasManager * The path alias manager. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * Entity type manager. @@ -127,7 +127,7 @@ class InstallHelper implements ContainerInjectionInterface { */ public static function create(ContainerInterface $container) { return new static( - $container->get('path.alias_manager'), + $container->get('path_alias.manager'), $container->get('entity_type.manager'), $container->get('module_handler'), $container->get('state'), diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php index f9b56859d44..12569a6ca72 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php @@ -63,7 +63,7 @@ class RequestPathTest extends KernelTestBase { // Set a mock alias manager in the container. $this->aliasManager = new MockAliasManager(); - $this->container->set('path.alias_manager', $this->aliasManager); + $this->container->set('path_alias.manager', $this->aliasManager); // Set the test request stack in the container. $this->requestStack = new RequestStack(); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php index 7ab002d9c06..6daa3964c8d 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php @@ -576,8 +576,8 @@ class RouteProviderTest extends KernelTestBase { // A path with a path alias. $this->createPathAlias('/path/add/one', '/path/add-one'); - /** @var \Drupal\Core\Path\AliasManagerInterface $alias_manager */ - $alias_manager = \Drupal::service('path.alias_manager'); + /** @var \Drupal\path_alias\AliasManagerInterface $alias_manager */ + $alias_manager = \Drupal::service('path_alias.manager'); $alias_manager->cacheClear(); $path = '/path/add-one'; diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php index 63b94ff4638..d9cb77aea9c 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\Core\DependencyInjection\Compiler; use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Core\Path\CurrentPathStack; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; @@ -67,7 +68,7 @@ class ProxyServicesPassTest extends UnitTestCase { */ public function testContainerWithLazyServicesWithoutProxyClass() { $container = new ContainerBuilder(); - $container->register('alias_whitelist', 'Drupal\Core\Path\AliasWhitelist') + $container->register('path.current', CurrentPathStack::class) ->setLazy(TRUE); $this->expectException(InvalidArgumentException::class); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php index ce401b12557..0233f71e1df 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -4,15 +4,15 @@ namespace Drupal\Tests\Core\PathProcessor; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\PathProcessor\PathProcessorAlias; use Drupal\Core\PathProcessor\PathProcessorDecode; use Drupal\Core\PathProcessor\PathProcessorFront; use Drupal\Core\PathProcessor\PathProcessorManager; use Drupal\language\HttpKernel\PathProcessorLanguage; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; -use Symfony\Component\HttpFoundation\Request; - +use Drupal\path_alias\AliasManager; +use Drupal\path_alias\PathProcessor\AliasPathProcessor; use Drupal\Tests\UnitTestCase; +use Symfony\Component\HttpFoundation\Request; /** * Tests processing of the inbound path. @@ -87,7 +87,7 @@ class PathProcessorTest extends UnitTestCase { public function testProcessInbound() { // Create an alias manager stub. - $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') + $alias_manager = $this->getMockBuilder(AliasManager::class) ->disableOriginalConstructor() ->getMock(); @@ -148,7 +148,7 @@ class PathProcessorTest extends UnitTestCase { ->getMock(); // Create the processors. - $alias_processor = new PathProcessorAlias($alias_manager); + $alias_processor = new AliasPathProcessor($alias_manager); $decode_processor = new PathProcessorDecode(); $front_processor = new PathProcessorFront($config_factory_stub); $language_processor = new PathProcessorLanguage($config_factory_stub, $this->languageManager, $negotiator, $current_user, $config_subscriber); diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index c01aafac0d7..35ebc81c818 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -5,12 +5,12 @@ namespace Drupal\Tests\Core\Routing; use Drupal\Core\Cache\Cache; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; -use Drupal\Core\PathProcessor\PathProcessorAlias; use Drupal\Core\PathProcessor\PathProcessorManager; use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Routing\RequestContext; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Routing\UrlGenerator; +use Drupal\path_alias\PathProcessor\AliasPathProcessor; use Drupal\Tests\UnitTestCase; use Prophecy\Argument; use Symfony\Component\HttpFoundation\Request; @@ -43,7 +43,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * The alias manager. * - * @var \Drupal\Core\Path\AliasManager|\PHPUnit\Framework\MockObject\MockObject + * @var \Drupal\path_alias\AliasManager|\PHPUnit\Framework\MockObject\MockObject */ protected $aliasManager; @@ -143,7 +143,7 @@ class UrlGeneratorTest extends UnitTestCase { ->will($this->returnValueMap($routes_names_return_map)); // Create an alias manager stub. - $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') + $alias_manager = $this->getMockBuilder('Drupal\path_alias\AliasManager') ->disableOriginalConstructor() ->getMock(); @@ -160,7 +160,7 @@ class UrlGeneratorTest extends UnitTestCase { $this->context = new RequestContext(); $this->context->fromRequestStack($this->requestStack); - $processor = new PathProcessorAlias($this->aliasManager); + $processor = new AliasPathProcessor($this->aliasManager); $processor_manager = new PathProcessorManager(); $processor_manager->addOutbound($processor, 1000); $this->processorManager = $processor_manager; diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index 4094a48d573..5843bae302a 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -42,7 +42,7 @@ class UrlTest extends UnitTestCase { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Drupal\path_alias\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $pathAliasManager; @@ -101,7 +101,7 @@ class UrlTest extends UnitTestCase { ->method('generateFromRoute') ->will($this->returnValueMap($generate_from_route_map)); - $this->pathAliasManager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $this->pathAliasManager = $this->createMock('Drupal\path_alias\AliasManagerInterface'); $this->pathAliasManager->expects($this->any()) ->method('getPathByAlias') ->will($this->returnValueMap($alias_map)); @@ -112,7 +112,7 @@ class UrlTest extends UnitTestCase { $this->container = new ContainerBuilder(); $this->container->set('router.no_access_checks', $this->router); $this->container->set('url_generator', $this->urlGenerator); - $this->container->set('path.alias_manager', $this->pathAliasManager); + $this->container->set('path_alias.manager', $this->pathAliasManager); $this->container->set('path.validator', $this->pathValidator); \Drupal::setContainer($this->container); } diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index f29d989c18c..6e7f24ba7cd 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -147,15 +147,6 @@ trait DeprecationListenerTrait { 'The "core/classList" asset library is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the the native browser implementation instead. See https://www.drupal.org/node/3089511', 'The "core/jquery.ui.datepicker" asset library is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. See https://www.drupal.org/node/3081864', 'The "locale/drupal.locale.datepicker" asset library is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. See https://www.drupal.org/node/3081864', - // These deprecations are triggered when instantiating path alias - // services. The new versions live in the "path_alias" module. - // @todo Remove in https://www.drupal.org/node/3092090. - 'The "path.alias_manager" service is deprecated. Use "path_alias.manager" instead. See https://drupal.org/node/3092086', - 'The \Drupal\Core\EventSubscriber\PathSubscriber class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\EventSubscriber\PathAliasSubscriber. See https://drupal.org/node/3092086', - 'The \Drupal\Core\PathProcessor\PathProcessorAlias class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\PathProcessor\AliasPathProcessor. See https://drupal.org/node/3092086', - 'The \Drupal\Core\Path\AliasManager class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\AliasManager. See https://drupal.org/node/3092086', - 'The \Drupal\Core\Path\AliasRepository class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\AliasRepository. See https://drupal.org/node/3092086', - 'The \Drupal\Core\Path\AliasWhitelist class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\AliasWhitelist. See https://drupal.org/node/3092086', ]; }