projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Security update for Core, with self-updated composer
[yaffs-website]
/
web
/
core
/
modules
/
system
/
tests
/
src
/
Unit
/
Breadcrumbs
/
PathBasedBreadcrumbBuilderTest.php
diff --git
a/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
b/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index d1eb8fb903e6d38e6d56b5db1cb3031e2ebebfce..2fe4a8335d0a3842d2fa9f7d39d5fd6234c85e81 100644
(file)
--- a/
web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/
web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@
-11,6
+11,7
@@
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Link;
use Drupal\Core\Access\AccessResultAllowed;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Link;
use Drupal\Core\Access\AccessResultAllowed;
+use Drupal\Core\Path\PathMatcherInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Url;
use Drupal\Core\Utility\LinkGeneratorInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Url;
use Drupal\Core\Utility\LinkGeneratorInterface;
@@
-84,6
+85,13
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
*/
protected $currentPath;
*/
protected $currentPath;
+ /**
+ * The mocked path matcher service.
+ *
+ * @var \Drupal\Core\Path\PathMatcherInterface|\PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $pathMatcher;
+
/**
* {@inheritdoc}
*
/**
* {@inheritdoc}
*
@@
-106,6
+114,8
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
->disableOriginalConstructor()
->getMock();
->disableOriginalConstructor()
->getMock();
+ $this->pathMatcher = $this->getMock(PathMatcherInterface::class);
+
$this->builder = new TestPathBasedBreadcrumbBuilder(
$this->context,
$this->accessManager,
$this->builder = new TestPathBasedBreadcrumbBuilder(
$this->context,
$this->accessManager,
@@
-114,7
+124,8
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$config_factory,
$this->titleResolver,
$this->currentUser,
$config_factory,
$this->titleResolver,
$this->currentUser,
- $this->currentPath
+ $this->currentPath,
+ $this->pathMatcher
);
$this->builder->setStringTranslation($this->getStringTranslationStub());
);
$this->builder->setStringTranslation($this->getStringTranslationStub());
@@
-136,9
+147,9
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
* @covers ::build
*/
public function testBuildOnFrontpage() {
* @covers ::build
*/
public function testBuildOnFrontpage() {
- $this->
context
->expects($this->once())
- ->method('
getPathInfo
')
- ->will
($this->returnValue('/')
);
+ $this->
pathMatcher
->expects($this->once())
+ ->method('
isFrontPage
')
+ ->will
Return(TRUE
);
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([], $breadcrumb->getLinks());
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([], $breadcrumb->getLinks());
@@
-180,7
+191,7
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$this->requestMatcher->expects($this->exactly(1))
->method('matchRequest')
$this->requestMatcher->expects($this->exactly(1))
->method('matchRequest')
- ->will($this->returnCallback(function(Request $request) use ($route_1) {
+ ->will($this->returnCallback(function
(Request $request) use ($route_1) {
if ($request->getPathInfo() == '/example') {
return [
RouteObjectInterface::ROUTE_NAME => 'example',
if ($request->getPathInfo() == '/example') {
return [
RouteObjectInterface::ROUTE_NAME => 'example',
@@
-216,7
+227,7
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$this->requestMatcher->expects($this->exactly(2))
->method('matchRequest')
$this->requestMatcher->expects($this->exactly(2))
->method('matchRequest')
- ->will($this->returnCallback(function(Request $request) use ($route_1, $route_2) {
+ ->will($this->returnCallback(function
(Request $request) use ($route_1, $route_2) {
if ($request->getPathInfo() == '/example/bar') {
return [
RouteObjectInterface::ROUTE_NAME => 'example_bar',
if ($request->getPathInfo() == '/example/bar') {
return [
RouteObjectInterface::ROUTE_NAME => 'example_bar',
@@
-346,7
+357,7
@@
class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$this->requestMatcher->expects($this->exactly(1))
->method('matchRequest')
$this->requestMatcher->expects($this->exactly(1))
->method('matchRequest')
- ->will($this->returnCallback(function(Request $request) use ($route_1) {
+ ->will($this->returnCallback(function
(Request $request) use ($route_1) {
if ($request->getPathInfo() == '/user/1') {
return [
RouteObjectInterface::ROUTE_NAME => 'user_page',
if ($request->getPathInfo() == '/user/1') {
return [
RouteObjectInterface::ROUTE_NAME => 'user_page',