Issue #3110580 by ankithashetty, init90, Sivaji_Ganesh_Jojodae, longwave: Resolve @todo - remove ::processOutbound() when we remove UrlGenerator::fromPath()

merge-requests/1325/head
Alex Pott 2021-10-18 12:05:28 +01:00
parent 6d04e573e3
commit 1d93843f6a
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
3 changed files with 1 additions and 39 deletions

View File

@ -1351,7 +1351,6 @@ services:
class: Drupal\Core\PathProcessor\PathProcessorFront
tags:
- { name: path_processor_inbound, priority: 200 }
- { name: path_processor_outbound, priority: 200 }
arguments: ['@config.factory']
route_processor_current:
class: Drupal\Core\RouteProcessor\RouteProcessorCurrent

View File

@ -3,16 +3,13 @@
namespace Drupal\Core\PathProcessor;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Processes the inbound path by resolving it to the front page if empty.
*
* @todo - remove ::processOutbound() when we remove UrlGenerator::fromPath().
*/
class PathProcessorFront implements InboundPathProcessorInterface, OutboundPathProcessorInterface {
class PathProcessorFront implements InboundPathProcessorInterface {
/**
* A config factory for retrieving required config settings.
@ -56,15 +53,4 @@ class PathProcessorFront implements InboundPathProcessorInterface, OutboundPathP
return $path;
}
/**
* {@inheritdoc}
*/
public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
// The special path '<front>' links to the default front page.
if ($path === '/<front>') {
$path = '/';
}
return $path;
}
}

View File

@ -68,27 +68,4 @@ class PathProcessorFrontTest extends UnitTestCase {
$processor->processInbound('/', new Request());
}
/**
* Tests basic outbound processing functionality.
*
* @covers ::processOutbound
* @dataProvider providerProcessOutbound
*/
public function testProcessOutbound($path, $expected) {
$config_factory = $this->prophesize(ConfigFactoryInterface::class);
$processor = new PathProcessorFront($config_factory->reveal());
$this->assertEquals($expected, $processor->processOutbound($path));
}
/**
* Outbound paths and expected results.
*/
public function providerProcessOutbound() {
return [
['/<front>', '/'],
['<front>', '<front>'],
['/user', '/user'],
];
}
}