$pages = "/my/pass/page\r\n/my/pass/page2\r\n/foo";
$request = Request::
create('/my/pass/page2'
);
$this->requestStack->
push($request);
/** @var \Drupal\system\Plugin\Condition\RequestPath $condition */
$condition =
$this->pluginManager->
createInstance('request_path'
);
$this->
assertEquals('No page is specified',
$condition->
summary());
$condition->
setConfig('pages',
$pages);
$this->aliasManager->
addAlias('/my/pass/page2', '/my/pass/page2'
);
$this->
assertTrue($condition->
execute(), 'The request path matches a standard path'
);
$this->
assertEquals('Return true on the following pages: /my/pass/page, /my/pass/page2, /foo',
$condition->
summary(), 'The condition summary matches for a standard path'
);
// Test an aliased path.
$this->currentPath->
setPath('/my/aliased/page',
$request);
$this->requestStack->
pop();
$this->requestStack->
push($request);
$this->aliasManager->
addAlias('/my/aliased/page', '/my/pass/page'
);