summaryrefslogtreecommitdiffstats
path: root/tests/src/Unit/Plugin
diff options
context:
space:
mode:
authorStryKaizer2015-12-02 18:24:11 (GMT)
committerJimmy Henderickx2015-12-02 18:24:25 (GMT)
commit3ca4f4bbbd45eae09c9e146387827fc97931408a (patch)
treeb37c218a2220f854d246868ee4ff6c1366bd4b31 /tests/src/Unit/Plugin
parent68d5a9442328fb86f3b3f52f033c5606cf43824f (diff)
Issue #2626458 by borisson_, StryKaizer: Refactor getPath to use facet source directly
Diffstat (limited to 'tests/src/Unit/Plugin')
-rw-r--r--tests/src/Unit/Plugin/processor/QueryStringUrlProcessorTest.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/src/Unit/Plugin/processor/QueryStringUrlProcessorTest.php b/tests/src/Unit/Plugin/processor/QueryStringUrlProcessorTest.php
index ad41c24..103eeb6 100644
--- a/tests/src/Unit/Plugin/processor/QueryStringUrlProcessorTest.php
+++ b/tests/src/Unit/Plugin/processor/QueryStringUrlProcessorTest.php
@@ -79,6 +79,7 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
public function testEmptyBuild() {
$facet = new Facet([], 'facet');
+ $facet->setFacetSourceId('facet_source__dummy');
$request = new Request;
$request->query->set('f', []);
@@ -91,11 +92,12 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
public function testBuild() {
$facet = new Facet([], 'facet');
$facet->setFieldIdentifier('test');
+ $facet->setFacetSourceId('facet_source__dummy');
$request = new Request;
$request->query->set('f', []);
- $this->setRouter();
+ $this->setContainer();
$this->processor = new QueryStringUrlProcessor([], 'query_string', [], $request);
$results = $this->processor->build($facet, $this->original_results);
@@ -110,6 +112,7 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
public function testBuildWithActiveItem() {
$facet = new Facet([], 'facet');
$facet->setFieldIdentifier('test');
+ $facet->setFacetSourceId('facet_source__dummy');
$original_results = $this->original_results;
$original_results[2]->setActiveState(TRUE);
@@ -117,7 +120,7 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
$request = new Request;
$request->query->set('f', ['king:kong']);
- $this->setRouter();
+ $this->setContainer();
$this->processor = new QueryStringUrlProcessor([], 'query_string', [], $request);
$results = $this->processor->build($facet, $original_results);
@@ -134,7 +137,7 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
}
}
- protected function setRouter() {
+ protected function setContainer() {
$router = $this->getMockBuilder('Drupal\Tests\Core\Routing\TestRouterInterface')
->disableOriginalConstructor()
->getMock();
@@ -147,8 +150,21 @@ class QueryStringUrlProcessorTest extends UnitTestCase {
]
);
+ $fsi = $this->getMockBuilder('\Drupal\facetapi\FacetSource\FacetSourceInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $fsi->method('getPath')
+ ->willReturn('search/test');
+
+ $manager = $this->getMockBuilder('Drupal\facetapi\FacetSource\FacetSourcePluginManager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $manager->method('createInstance')
+ ->willReturn($fsi);
+
$container = new ContainerBuilder();
$container->set('router.no_access_checks', $router);
+ $container->set('plugin.manager.facetapi.facet_source', $manager);
\Drupal::setContainer($container);
}