diff --git a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php b/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php index 8298431..e3cb884 100644 --- a/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php +++ b/core/modules/system/src/Tests/Plugin/Condition/RequestPathTest.php @@ -52,7 +52,7 @@ class RequestPathTest extends KernelTestBase { /** * The current path. * - * @var \Drupal\Core\Path\CurrentPath + * @var \Drupal\Core\Path\CurrentPath|\PHPUnit_Framework_MockObject_MockObject */ protected $currentPath; @@ -75,6 +75,7 @@ protected function setUp() { $this->container->set('request_stack', $this->requestStack); $this->currentPath = new CurrentPath($this->requestStack); + $this->container->set('path.current', $this->currentPath); } /** diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php index fb53029..dcbdf3b 100644 --- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php +++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php @@ -77,6 +77,13 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase { protected $pathProcessor; /** + * The mocked current path. + * + * @var \Drupal\Core\Path\CurrentPath|\PHPUnit_Framework_MockObject_MockObject + */ + protected $currentPath; + + /** * {@inheritdoc} * * @covers ::__construct @@ -94,6 +101,10 @@ protected function setUp() { $this->accessManager = $this->getMock('\Drupal\Core\Access\AccessManagerInterface'); $this->titleResolver = $this->getMock('\Drupal\Core\Controller\TitleResolverInterface'); $this->currentUser = $this->getMock('Drupal\Core\Session\AccountInterface'); + $this->currentPath = $this->getMockBuilder('Drupal\Core\Path\CurrentPath') + ->disableOriginalConstructor() + ->getMock(); + $this->builder = new TestPathBasedBreadcrumbBuilder( $this->context, $this->accessManager, @@ -101,7 +112,8 @@ protected function setUp() { $this->pathProcessor, $config_factory, $this->titleResolver, - $this->currentUser + $this->currentUser, + $this->currentPath ); $this->builder->setStringTranslation($this->getStringTranslationStub()); diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index 7e09cb4..3493a74 100644 --- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -40,6 +40,13 @@ class ViewAjaxControllerTest extends UnitTestCase { */ protected $viewAjaxController; + /** + * The mocked current path. + * + * @var \Drupal\Core\Path\CurrentPath|\PHPUnit_Framework_MockObject_MockObject + */ + protected $currentPath; + protected function setUp() { $this->viewStorage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface'); $this->executableFactory = $this->getMockBuilder('Drupal\views\ViewExecutableFactory') @@ -52,8 +59,11 @@ protected function setUp() { $elements['#attached'] = []; return isset($elements['#markup']) ? $elements['#markup'] : ''; })); + $this->currentPath = $this->getMockBuilder('Drupal\Core\Path\CurrentPath') + ->disableOriginalConstructor() + ->getMock(); - $this->viewAjaxController = new ViewAjaxController($this->viewStorage, $this->executableFactory, $this->renderer); + $this->viewAjaxController = new ViewAjaxController($this->viewStorage, $this->executableFactory, $this->renderer, $this->currentPath); } /**