public function testPathChangedHelper() { $route = \Drupal::
service('router.route_provider'
)->
getRouteByName('path.changed.bc'
);
$raw_parameters =
[ 'block_type' => 'test_block_type',
];
$query =
[ 'destination' => 'admin/structure/block',
'plugin_id' => 'some_block_config',
];
$helper =
new PathChangedHelper( new RouteMatch('path.changed.bc',
$route,
[],
$raw_parameters),
new Request($query) );
// Assert that oldPath() returns the internal path for path.changed.bc.
$this->
assertEquals('old/path/test_block_type',
$helper->
oldPath());
// Assert that newPath() returns the internal path for path.changed.
$this->
assertEquals('new/path/test_block_type',
$helper->
newPath());
// Assert that redirect() returns a RedirectResponse for the absolute URL of
// path.changed, and the query string comes from the Request object with the
// destination parameter removed.
$redirect =
$helper->
redirect();