Issue #3094292 by plach, Berdir, jibran: Remove usages of deprecated path alias services and clear "DeprecationListenerTrait" entries

merge-requests/64/head
catch 2019-11-15 11:36:59 +00:00
parent 6b2bc14e54
commit 4345267022
38 changed files with 183 additions and 106 deletions

View File

@ -761,9 +761,9 @@
* *
* A typical service definition in a *.services.yml file looks like this: * A typical service definition in a *.services.yml file looks like this:
* @code * @code
* path.alias_manager: * path_alias.manager:
* class: Drupal\path_alias\AliasManager * class: Drupal\path_alias\AliasManager
* arguments: ['@path.crud', '@path_alias.whitelist', '@language_manager'] * arguments: ['@path_alias.repository', '@path_alias.whitelist', '@language_manager']
* @endcode * @endcode
* Some services use other services as factories; a typical service definition * Some services use other services as factories; a typical service definition
* is: * is:

View File

@ -1218,7 +1218,7 @@ services:
- { name: event_subscriber } - { name: event_subscriber }
path_subscriber: path_subscriber:
class: Drupal\Core\EventSubscriber\PathSubscriber 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' deprecated: 'The "%service_id%" service is deprecated. Use "path_alias.subscriber" instead. See https://drupal.org/node/3092086'
route_access_response_subscriber: route_access_response_subscriber:
class: Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber class: Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber
@ -1352,7 +1352,7 @@ services:
- { name: route_processor_outbound, priority: 200 } - { name: route_processor_outbound, priority: 200 }
path_processor_alias: path_processor_alias:
class: Drupal\Core\PathProcessor\PathProcessorAlias 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' deprecated: 'The "%service_id%" service is deprecated. Use "path_alias.path_processor" instead. See https://drupal.org/node/3092086'
route_processor_csrf: route_processor_csrf:
class: Drupal\Core\Access\RouteProcessorCsrf class: Drupal\Core\Access\RouteProcessorCsrf

View File

@ -12,10 +12,10 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* Provides a path subscriber that converts path aliases. * Provides a path subscriber that converts path aliases.
* *
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* Use \Drupal\path_alias\EventSubscriber\PathAliasSubscriber. * \Drupal\path_alias\EventSubscriber\PathAliasSubscriber instead.
* *
* @see https://www.drupal.org/node/3092086 * @see https://www.drupal.org/node/3092086
*/ */
class PathSubscriber implements EventSubscriberInterface { class PathSubscriber implements EventSubscriberInterface {

View File

@ -12,10 +12,10 @@ use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceExce
/** /**
* The default alias manager implementation. * The default alias manager implementation.
* *
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* Use \Drupal\path_alias\AliasManager. * \Drupal\path_alias\AliasManager instead.
* *
* @see https://www.drupal.org/node/3092086 * @see https://www.drupal.org/node/3092086
*/ */
class AliasManager implements AliasManagerInterface, CacheDecoratorInterface { class AliasManager implements AliasManagerInterface, CacheDecoratorInterface {

View File

@ -10,10 +10,10 @@ use Drupal\Core\Language\LanguageInterface;
/** /**
* Provides the default path alias lookup operations. * Provides the default path alias lookup operations.
* *
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* Use \Drupal\path_alias\AliasRepository. * \Drupal\path_alias\AliasRepository instead.
* *
* @see https://www.drupal.org/node/3092086 * @see https://www.drupal.org/node/3092086
*/ */
class AliasRepository implements AliasRepositoryInterface { class AliasRepository implements AliasRepositoryInterface {

View File

@ -11,10 +11,10 @@ use Drupal\Core\Lock\LockBackendInterface;
/** /**
* Extends CacheCollector to build the path alias whitelist over time. * Extends CacheCollector to build the path alias whitelist over time.
* *
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* Use \Drupal\path_alias\AliasWhitelist. * \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 { class AliasWhitelist extends CacheCollector implements AliasWhitelistInterface {

View File

@ -9,10 +9,10 @@ use Symfony\Component\HttpFoundation\Request;
/** /**
* Processes the inbound path using path alias lookups. * Processes the inbound path using path alias lookups.
* *
* @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
* Use \Drupal\path_alias\PathProcessor\AliasPathProcessor. * \Drupal\path_alias\PathProcessor\AliasPathProcessor.
* *
* @see https://www.drupal.org/node/3092086 * @see https://www.drupal.org/node/3092086
*/ */
class PathProcessorAlias implements InboundPathProcessorInterface, OutboundPathProcessorInterface { class PathProcessorAlias implements InboundPathProcessorInterface, OutboundPathProcessorInterface {

View File

@ -106,10 +106,10 @@ class LocalePathTest extends BrowserTestBase {
// Check priority of language for alias by source path. // Check priority of language for alias by source path.
$path_alias = $this->createPathAlias('/node/' . $node->id(), '/' . $custom_path, LanguageInterface::LANGCODE_NOT_SPECIFIED); $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.'); $this->assertEqual('/' . $english_path, $lookup_path, 'English language alias has priority.');
// Same check for language 'xx'. // 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.'); $this->assertEqual('/' . $custom_language_path, $lookup_path, 'Custom language alias has priority.');
$path_alias->delete(); $path_alias->delete();

View File

@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Path\AliasManagerInterface; use Drupal\path_alias\AliasManagerInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\path\Form\PathFilterForm; use Drupal\path\Form\PathFilterForm;
use Symfony\Component\DependencyInjection\ContainerInterface; 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. * 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 { class PathAliasListBuilder extends EntityListBuilder {
@ -46,7 +46,7 @@ class PathAliasListBuilder extends EntityListBuilder {
/** /**
* The path alias manager. * The path alias manager.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -63,7 +63,7 @@ class PathAliasListBuilder extends EntityListBuilder {
* The form builder. * The form builder.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager. * The language manager.
* @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * @param \Drupal\path_alias\AliasManagerInterface $alias_manager
* The path 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) { 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('request_stack')->getCurrentRequest(),
$container->get('form_builder'), $container->get('form_builder'),
$container->get('language_manager'), $container->get('language_manager'),
$container->get('path.alias_manager') $container->get('path_alias.manager')
); );
} }

View File

@ -26,7 +26,7 @@ class PathFieldItemList extends FieldItemList {
$entity = $this->getEntity(); $entity = $this->getEntity();
if (!$entity->isNew()) { 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'); $path_alias_repository = \Drupal::service('path_alias.repository');
if ($path_alias = $path_alias_repository->lookupBySystemPath('/' . $entity->toUrl()->getInternalPath(), $this->getLangcode())) { if ($path_alias = $path_alias_repository->lookupBySystemPath('/' . $entity->toUrl()->getInternalPath(), $this->getLangcode())) {

View File

@ -14,9 +14,9 @@ abstract class UrlAliasBase extends DrupalSqlBase {
*/ */
public function query() { public function query() {
// The order of the migration is significant since // The order of the migration is significant since
// \Drupal\Core\Path\AliasRepository::lookupPathAlias() orders by pid before // \Drupal\path_alias\AliasRepository::lookupPathAlias() orders by pid
// returning a result. Postgres does not automatically order by primary key // before returning a result. Postgres does not automatically order by
// therefore we need to add a specific order by. // primary key therefore we need to add a specific order by.
return $this->select('url_alias', 'ua')->fields('ua')->orderBy('pid'); return $this->select('url_alias', 'ua')->fields('ua')->orderBy('pid');
} }

View File

@ -120,7 +120,7 @@ class PathAliasTest extends PathTestBase {
$this->assertText($node1->label(), 'Changed alias works.'); $this->assertText($node1->label(), 'Changed alias works.');
$this->assertResponse(200); $this->assertResponse(200);
$this->container->get('path.alias_manager')->cacheClear(); $this->container->get('path_alias.manager')->cacheClear();
// Confirm that previous alias no longer works. // Confirm that previous alias no longer works.
$this->drupalGet($previous); $this->drupalGet($previous);
$this->assertNoText($node1->label(), 'Previous alias no longer works.'); $this->assertNoText($node1->label(), 'Previous alias no longer works.');

View File

@ -101,7 +101,7 @@ class PathLanguageTest extends PathTestBase {
$this->drupalPostForm(NULL, $edit, t('Save (this translation)')); $this->drupalPostForm(NULL, $edit, t('Save (this translation)'));
// Clear the path lookup cache. // 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. // Languages are cached on many levels, and we need to clear those caches.
$this->container->get('language_manager')->reset(); $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 // The alias manager has an internal path lookup cache. Check to see that
// it has the appropriate contents at this point. // it has the appropriate contents at this point.
$this->container->get('path.alias_manager')->cacheClear(); $this->container->get('path_alias.manager')->cacheClear();
$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 works.'); $this->assertEqual($french_node_path, '/node/' . $english_node_french_translation->id(), 'Normal path works.');
// Second call should return the same path. // 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.'); $this->assertEqual($french_node_path, '/node/' . $english_node_french_translation->id(), 'Normal path is the same.');
// Confirm that the alias works. // 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.'); $this->assertEqual($french_node_alias, '/' . $french_alias, 'Alias works.');
// Second call should return the same alias. // 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.'); $this->assertEqual($french_node_alias, '/' . $french_alias, 'Alias is the same.');
// Confirm that the alias is removed if the translation is deleted. // Confirm that the alias is removed if the translation is deleted.

View File

@ -44,7 +44,7 @@ class PathItemTest extends KernelTestBase {
* Test creating, loading, updating and deleting aliases through PathItem. * Test creating, loading, updating and deleting aliases through PathItem.
*/ */
public function testPathItem() { public function testPathItem() {
/** @var \Drupal\Core\Path\AliasRepositoryInterface $alias_repository */ /** @var \Drupal\path_alias\AliasRepositoryInterface $alias_repository */
$alias_repository = \Drupal::service('path_alias.repository'); $alias_repository = \Drupal::service('path_alias.repository');
$node_storage = \Drupal::entityTypeManager()->getStorage('node'); $node_storage = \Drupal::entityTypeManager()->getStorage('node');

View File

@ -106,7 +106,7 @@ class PathAlias extends ContentEntityBase implements PathAliasInterface {
public function postSave(EntityStorageInterface $storage, $update = TRUE) { public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update); parent::postSave($storage, $update);
$alias_manager = \Drupal::service('path.alias_manager'); $alias_manager = \Drupal::service('path_alias.manager');
$alias_manager->cacheClear($this->getPath()); $alias_manager->cacheClear($this->getPath());
if ($update) { if ($update) {
$alias_manager->cacheClear($this->original->getPath()); $alias_manager->cacheClear($this->original->getPath());
@ -119,7 +119,7 @@ class PathAlias extends ContentEntityBase implements PathAliasInterface {
public static function postDelete(EntityStorageInterface $storage, array $entities) { public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities); parent::postDelete($storage, $entities);
$alias_manager = \Drupal::service('path.alias_manager'); $alias_manager = \Drupal::service('path_alias.manager');
foreach ($entities as $entity) { foreach ($entities as $entity) {
$alias_manager->cacheClear($entity->getPath()); $alias_manager->cacheClear($entity->getPath());
} }

View File

@ -119,7 +119,7 @@ class UrlAlterFunctionalTest extends BrowserTestBase {
*/ */
protected function assertUrlInboundAlter($original, $final) { protected function assertUrlInboundAlter($original, $final) {
// Test inbound altering. // 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])); return $this->assertIdentical($result, $final, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result]));
} }

View File

@ -12,7 +12,7 @@ use Drupal\Tests\Traits\Core\PathAliasTestTrait;
/** /**
* Tests path alias CRUD and lookup functionality. * Tests path alias CRUD and lookup functionality.
* *
* @coversDefaultClass \Drupal\Core\Path\AliasRepository * @coversDefaultClass \Drupal\path_alias\AliasRepository
* *
* @group path_alias * @group path_alias
*/ */
@ -61,12 +61,12 @@ class AliasTest extends KernelTestBase {
} }
/** /**
* @covers \Drupal\Core\Path\AliasManager::getPathByAlias * @covers \Drupal\path_alias\AliasManager::getPathByAlias
* @covers \Drupal\Core\Path\AliasManager::getAliasByPath * @covers \Drupal\path_alias\AliasManager::getAliasByPath
*/ */
public function testLookupPath() { public function testLookupPath() {
// Create AliasManager and Path object. // 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. // Test the situation where the source is the same for multiple aliases.
// Start with a language-neutral alias, which we will override. // Start with a language-neutral alias, which we will override.

View File

@ -45,7 +45,7 @@ class PathHooksTest extends KernelTestBase {
$alias_manager = $this->prophesize(AliasManagerInterface::class); $alias_manager = $this->prophesize(AliasManagerInterface::class);
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1); $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1);
$alias_manager->cacheClear($path_alias->getPath())->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(); $path_alias->save();
$new_source = '/' . $this->randomMachineName(); $new_source = '/' . $this->randomMachineName();
@ -56,7 +56,7 @@ class PathHooksTest extends KernelTestBase {
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(2); $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(2);
$alias_manager->cacheClear($path_alias->getPath())->shouldBeCalledTimes(1); $alias_manager->cacheClear($path_alias->getPath())->shouldBeCalledTimes(1);
$alias_manager->cacheClear($new_source)->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->setPath($new_source);
$path_alias->save(); $path_alias->save();
@ -64,7 +64,7 @@ class PathHooksTest extends KernelTestBase {
$alias_manager = $this->prophesize(AliasManagerInterface::class); $alias_manager = $this->prophesize(AliasManagerInterface::class);
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1); $alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1);
$alias_manager->cacheClear($new_source)->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(); $path_alias->delete();
} }

View File

@ -4,7 +4,7 @@ namespace Drupal\Tests\path_alias\Unit;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Path\AliasRepositoryInterface; use Drupal\path_alias\AliasRepositoryInterface;
use Drupal\path_alias\AliasManager; use Drupal\path_alias\AliasManager;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
@ -31,7 +31,7 @@ class AliasManagerTest extends UnitTestCase {
/** /**
* Alias repository. * Alias repository.
* *
* @var \Drupal\Core\Path\AliasRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject * @var \Drupal\path_alias\AliasRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject
*/ */
protected $aliasRepository; protected $aliasRepository;

View File

@ -8,6 +8,7 @@ use Drupal\Core\EventSubscriber\PathSubscriber;
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\Path\AliasManager as CoreAliasManager; 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\AliasWhitelist as CoreAliasWhitelist;
use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\PathProcessor\PathProcessorAlias; use Drupal\Core\PathProcessor\PathProcessorAlias;
@ -19,7 +20,10 @@ use Drupal\path_alias\AliasWhitelist;
use Drupal\path_alias\AliasWhitelistInterface; use Drupal\path_alias\AliasWhitelistInterface;
use Drupal\path_alias\EventSubscriber\PathAliasSubscriber; use Drupal\path_alias\EventSubscriber\PathAliasSubscriber;
use Drupal\path_alias\PathProcessor\AliasPathProcessor; use Drupal\path_alias\PathProcessor\AliasPathProcessor;
use Drupal\system\Form\SiteInformationForm;
use Drupal\system\Plugin\Condition\RequestPath;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\argument_default\Raw;
/** /**
* Tests deprecation of path alias core service classes. * Tests deprecation of path alias core service classes.
@ -167,4 +171,65 @@ class DeprecatedClassesTest extends UnitTestCase {
$this->assertInstanceOf(CoreAliasWhitelist::class, $object); $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));
}
} }

View File

@ -3,11 +3,12 @@
namespace Drupal\system\Form; namespace Drupal\system\Form;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Form\ConfigFormBase; 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\Path\PathValidatorInterface;
use Drupal\Core\Routing\RequestContext; use Drupal\Core\Routing\RequestContext;
use Drupal\path_alias\AliasManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
@ -20,7 +21,7 @@ class SiteInformationForm extends ConfigFormBase {
/** /**
* The path alias manager. * The path alias manager.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -43,16 +44,21 @@ class SiteInformationForm extends ConfigFormBase {
* *
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects. * The factory for configuration objects.
* @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * @param \Drupal\path_alias\AliasManagerInterface $alias_manager
* The path alias manager. * The path alias manager.
* @param \Drupal\Core\Path\PathValidatorInterface $path_validator * @param \Drupal\Core\Path\PathValidatorInterface $path_validator
* The path validator. * The path validator.
* @param \Drupal\Core\Routing\RequestContext $request_context * @param \Drupal\Core\Routing\RequestContext $request_context
* The 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); 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->aliasManager = $alias_manager;
$this->pathValidator = $path_validator; $this->pathValidator = $path_validator;
$this->requestContext = $request_context; $this->requestContext = $request_context;
@ -64,7 +70,7 @@ class SiteInformationForm extends ConfigFormBase {
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('config.factory'), $container->get('config.factory'),
$container->get('path.alias_manager'), $container->get('path_alias.manager'),
$container->get('path.validator'), $container->get('path.validator'),
$container->get('router.request_context') $container->get('router.request_context')
); );

View File

@ -4,10 +4,11 @@ namespace Drupal\system\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase; use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Core\Form\FormStateInterface; 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\CurrentPathStack;
use Drupal\Core\Path\PathMatcherInterface; use Drupal\Core\Path\PathMatcherInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\path_alias\AliasManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack; 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. * An alias manager to find the alias for the current system path.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -52,7 +53,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
/** /**
* Constructs a RequestPath condition plugin. * 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. * An alias manager to find the alias for the current system path.
* @param \Drupal\Core\Path\PathMatcherInterface $path_matcher * @param \Drupal\Core\Path\PathMatcherInterface $path_matcher
* The path matcher service. * The path matcher service.
@ -67,8 +68,14 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
* @param array $plugin_definition * @param array $plugin_definition
* The plugin implementation 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); 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->aliasManager = $alias_manager;
$this->pathMatcher = $path_matcher; $this->pathMatcher = $path_matcher;
$this->requestStack = $request_stack; $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) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static( return new static(
$container->get('path.alias_manager'), $container->get('path_alias.manager'),
$container->get('path.matcher'), $container->get('path.matcher'),
$container->get('request_stack'), $container->get('request_stack'),
$container->get('path.current'), $container->get('path.current'),

View File

@ -2,7 +2,7 @@
namespace Drupal\system\Tests\Routing; namespace Drupal\system\Tests\Routing;
use Drupal\Core\Path\AliasManagerInterface; use Drupal\path_alias\AliasManagerInterface;
/** /**
* An easily configurable mock alias manager. * An easily configurable mock alias manager.

View File

@ -5,8 +5,9 @@ namespace Drupal\views\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface; 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\CurrentPathStack;
use Drupal\path_alias\AliasManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
@ -24,7 +25,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
/** /**
* The alias manager. * The alias manager.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -44,14 +45,19 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
* The plugin_id for the plugin instance. * The plugin_id for the plugin instance.
* @param mixed $plugin_definition * @param mixed $plugin_definition
* The plugin implementation definition. * The plugin implementation definition.
* @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * @param \Drupal\path_alias\AliasManagerInterface $alias_manager
* The alias manager. * The alias manager.
* @param \Drupal\Core\Path\CurrentPathStack $current_path * @param \Drupal\Core\Path\CurrentPathStack $current_path
* The 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); 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->aliasManager = $alias_manager;
$this->currentPath = $current_path; $this->currentPath = $current_path;
} }
@ -64,7 +70,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
$configuration, $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('path.alias_manager'), $container->get('path_alias.manager'),
$container->get('path.current') $container->get('path.current')
); );
} }

View File

@ -3,6 +3,7 @@
namespace Drupal\Tests\views\Unit\Plugin\argument_default; namespace Drupal\Tests\views\Unit\Plugin\argument_default;
use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\CurrentPathStack;
use Drupal\path_alias\AliasManagerInterface;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\argument_default\Raw; use Drupal\views\Plugin\views\argument_default\Raw;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -33,7 +34,7 @@ class RawTest extends UnitTestCase {
$view->expects($this->any()) $view->expects($this->any())
->method('getRequest') ->method('getRequest')
->will($this->returnValue($request)); ->will($this->returnValue($request));
$alias_manager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); $alias_manager = $this->createMock(AliasManagerInterface::class);
$alias_manager->expects($this->never()) $alias_manager->expects($this->never())
->method('getAliasByPath'); ->method('getAliasByPath');
@ -71,7 +72,7 @@ class RawTest extends UnitTestCase {
$this->assertEquals(NULL, $raw->getArgument()); $this->assertEquals(NULL, $raw->getArgument());
// Setup an alias manager with a path alias. // 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()) $alias_manager->expects($this->any())
->method('getAliasByPath') ->method('getAliasByPath')
->with($this->equalTo('/test/example')) ->with($this->equalTo('/test/example'))

View File

@ -323,7 +323,7 @@ function views_ui_views_analyze(ViewExecutable $view) {
continue; continue;
} }
if ($display->hasPath() && $path = $display->getOption('path')) { 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) { 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'); $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');
} }

View File

@ -2,7 +2,7 @@
namespace Drupal\workspaces\EventSubscriber; namespace Drupal\workspaces\EventSubscriber;
use Drupal\Core\Path\AliasManagerInterface; use Drupal\path_alias\AliasManagerInterface;
use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Routing\CacheableRouteProviderInterface; use Drupal\Core\Routing\CacheableRouteProviderInterface;
use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Routing\RouteProviderInterface;
@ -20,7 +20,7 @@ class WorkspaceRequestSubscriber implements EventSubscriberInterface {
/** /**
* The alias manager that caches alias lookups based on the request. * The alias manager that caches alias lookups based on the request.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -48,7 +48,7 @@ class WorkspaceRequestSubscriber implements EventSubscriberInterface {
/** /**
* Constructs a new WorkspaceRequestSubscriber instance. * Constructs a new WorkspaceRequestSubscriber instance.
* *
* @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * @param \Drupal\path_alias\AliasManagerInterface $alias_manager
* The alias manager. * The alias manager.
* @param \Drupal\Core\Path\CurrentPathStack $current_path * @param \Drupal\Core\Path\CurrentPathStack $current_path
* The current path. * The current path.

View File

@ -265,7 +265,7 @@ class WorkspaceManager implements WorkspaceManagerInterface {
// Clear the static cache for path aliases. We can't inject the path alias // Clear the static cache for path aliases. We can't inject the path alias
// manager service because it would create a circular dependency. // manager service because it would create a circular dependency.
\Drupal::service('path.alias_manager')->cacheClear(); \Drupal::service('path_alias.manager')->cacheClear();
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace Drupal\Tests\workspaces\Unit; namespace Drupal\Tests\workspaces\Unit;
use Drupal\Core\Path\AliasManagerInterface; use Drupal\path_alias\AliasManagerInterface;
use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Routing\CacheableRouteProviderInterface; use Drupal\Core\Routing\CacheableRouteProviderInterface;
use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Routing\RouteProviderInterface;
@ -20,7 +20,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class WorkspaceRequestSubscriberTest extends UnitTestCase { class WorkspaceRequestSubscriberTest extends UnitTestCase {
/** /**
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;

View File

@ -40,7 +40,7 @@ services:
- { name: 'event_subscriber' } - { name: 'event_subscriber' }
workspaces.workspace_subscriber: workspaces.workspace_subscriber:
class: Drupal\workspaces\EventSubscriber\WorkspaceRequestSubscriber 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: tags:
- { name: event_subscriber } - { name: event_subscriber }

View File

@ -8,7 +8,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileSystemInterface; use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Path\AliasManagerInterface; use Drupal\path_alias\AliasManagerInterface;
use Drupal\Core\State\StateInterface; use Drupal\Core\State\StateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
@ -23,7 +23,7 @@ class InstallHelper implements ContainerInjectionInterface {
/** /**
* The path alias manager. * The path alias manager.
* *
* @var \Drupal\Core\Path\AliasManagerInterface * @var \Drupal\path_alias\AliasManagerInterface
*/ */
protected $aliasManager; protected $aliasManager;
@ -99,7 +99,7 @@ class InstallHelper implements ContainerInjectionInterface {
/** /**
* Constructs a new InstallHelper object. * Constructs a new InstallHelper object.
* *
* @param \Drupal\Core\Path\AliasManagerInterface $aliasManager * @param \Drupal\path_alias\AliasManagerInterface $aliasManager
* The path alias manager. * The path alias manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity type manager. * Entity type manager.
@ -127,7 +127,7 @@ class InstallHelper implements ContainerInjectionInterface {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('path.alias_manager'), $container->get('path_alias.manager'),
$container->get('entity_type.manager'), $container->get('entity_type.manager'),
$container->get('module_handler'), $container->get('module_handler'),
$container->get('state'), $container->get('state'),

View File

@ -63,7 +63,7 @@ class RequestPathTest extends KernelTestBase {
// Set a mock alias manager in the container. // Set a mock alias manager in the container.
$this->aliasManager = new MockAliasManager(); $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. // Set the test request stack in the container.
$this->requestStack = new RequestStack(); $this->requestStack = new RequestStack();

View File

@ -576,8 +576,8 @@ class RouteProviderTest extends KernelTestBase {
// A path with a path alias. // A path with a path alias.
$this->createPathAlias('/path/add/one', '/path/add-one'); $this->createPathAlias('/path/add/one', '/path/add-one');
/** @var \Drupal\Core\Path\AliasManagerInterface $alias_manager */ /** @var \Drupal\path_alias\AliasManagerInterface $alias_manager */
$alias_manager = \Drupal::service('path.alias_manager'); $alias_manager = \Drupal::service('path_alias.manager');
$alias_manager->cacheClear(); $alias_manager->cacheClear();
$path = '/path/add-one'; $path = '/path/add-one';

View File

@ -4,6 +4,7 @@ namespace Drupal\Tests\Core\DependencyInjection\Compiler;
use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass; use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass;
use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
@ -67,7 +68,7 @@ class ProxyServicesPassTest extends UnitTestCase {
*/ */
public function testContainerWithLazyServicesWithoutProxyClass() { public function testContainerWithLazyServicesWithoutProxyClass() {
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->register('alias_whitelist', 'Drupal\Core\Path\AliasWhitelist') $container->register('path.current', CurrentPathStack::class)
->setLazy(TRUE); ->setLazy(TRUE);
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);

View File

@ -4,15 +4,15 @@ namespace Drupal\Tests\Core\PathProcessor;
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\PathProcessor\PathProcessorAlias;
use Drupal\Core\PathProcessor\PathProcessorDecode; use Drupal\Core\PathProcessor\PathProcessorDecode;
use Drupal\Core\PathProcessor\PathProcessorFront; use Drupal\Core\PathProcessor\PathProcessorFront;
use Drupal\Core\PathProcessor\PathProcessorManager; use Drupal\Core\PathProcessor\PathProcessorManager;
use Drupal\language\HttpKernel\PathProcessorLanguage; use Drupal\language\HttpKernel\PathProcessorLanguage;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; 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 Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Tests processing of the inbound path. * Tests processing of the inbound path.
@ -87,7 +87,7 @@ class PathProcessorTest extends UnitTestCase {
public function testProcessInbound() { public function testProcessInbound() {
// Create an alias manager stub. // Create an alias manager stub.
$alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') $alias_manager = $this->getMockBuilder(AliasManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -148,7 +148,7 @@ class PathProcessorTest extends UnitTestCase {
->getMock(); ->getMock();
// Create the processors. // Create the processors.
$alias_processor = new PathProcessorAlias($alias_manager); $alias_processor = new AliasPathProcessor($alias_manager);
$decode_processor = new PathProcessorDecode(); $decode_processor = new PathProcessorDecode();
$front_processor = new PathProcessorFront($config_factory_stub); $front_processor = new PathProcessorFront($config_factory_stub);
$language_processor = new PathProcessorLanguage($config_factory_stub, $this->languageManager, $negotiator, $current_user, $config_subscriber); $language_processor = new PathProcessorLanguage($config_factory_stub, $this->languageManager, $negotiator, $current_user, $config_subscriber);

View File

@ -5,12 +5,12 @@ namespace Drupal\Tests\Core\Routing;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\PathProcessor\PathProcessorAlias;
use Drupal\Core\PathProcessor\PathProcessorManager; use Drupal\Core\PathProcessor\PathProcessorManager;
use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Routing\RequestContext; use Drupal\Core\Routing\RequestContext;
use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Routing\UrlGenerator; use Drupal\Core\Routing\UrlGenerator;
use Drupal\path_alias\PathProcessor\AliasPathProcessor;
use Drupal\Tests\UnitTestCase; use Drupal\Tests\UnitTestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -43,7 +43,7 @@ class UrlGeneratorTest extends UnitTestCase {
/** /**
* The alias manager. * The alias manager.
* *
* @var \Drupal\Core\Path\AliasManager|\PHPUnit\Framework\MockObject\MockObject * @var \Drupal\path_alias\AliasManager|\PHPUnit\Framework\MockObject\MockObject
*/ */
protected $aliasManager; protected $aliasManager;
@ -143,7 +143,7 @@ class UrlGeneratorTest extends UnitTestCase {
->will($this->returnValueMap($routes_names_return_map)); ->will($this->returnValueMap($routes_names_return_map));
// Create an alias manager stub. // Create an alias manager stub.
$alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') $alias_manager = $this->getMockBuilder('Drupal\path_alias\AliasManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -160,7 +160,7 @@ class UrlGeneratorTest extends UnitTestCase {
$this->context = new RequestContext(); $this->context = new RequestContext();
$this->context->fromRequestStack($this->requestStack); $this->context->fromRequestStack($this->requestStack);
$processor = new PathProcessorAlias($this->aliasManager); $processor = new AliasPathProcessor($this->aliasManager);
$processor_manager = new PathProcessorManager(); $processor_manager = new PathProcessorManager();
$processor_manager->addOutbound($processor, 1000); $processor_manager->addOutbound($processor, 1000);
$this->processorManager = $processor_manager; $this->processorManager = $processor_manager;

View File

@ -42,7 +42,7 @@ class UrlTest extends UnitTestCase {
/** /**
* The path alias manager. * The path alias manager.
* *
* @var \Drupal\Core\Path\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject * @var \Drupal\path_alias\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject
*/ */
protected $pathAliasManager; protected $pathAliasManager;
@ -101,7 +101,7 @@ class UrlTest extends UnitTestCase {
->method('generateFromRoute') ->method('generateFromRoute')
->will($this->returnValueMap($generate_from_route_map)); ->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()) $this->pathAliasManager->expects($this->any())
->method('getPathByAlias') ->method('getPathByAlias')
->will($this->returnValueMap($alias_map)); ->will($this->returnValueMap($alias_map));
@ -112,7 +112,7 @@ class UrlTest extends UnitTestCase {
$this->container = new ContainerBuilder(); $this->container = new ContainerBuilder();
$this->container->set('router.no_access_checks', $this->router); $this->container->set('router.no_access_checks', $this->router);
$this->container->set('url_generator', $this->urlGenerator); $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); $this->container->set('path.validator', $this->pathValidator);
\Drupal::setContainer($this->container); \Drupal::setContainer($this->container);
} }

View File

@ -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/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 "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', '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',
]; ];
} }