ResetFacetsProcessorTest.php in Facets 8
File
modules/facets_summary/tests/src/Unit/Plugin/Processor/ResetFacetsProcessorTest.php
View source
<?php
namespace Drupal\Tests\facets_summary\Unit\Plugin\Processor;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\facets_summary\Entity\FacetsSummary;
use Drupal\facets_summary\Plugin\facets_summary\processor\ResetFacetsProcessor;
use Drupal\Tests\UnitTestCase;
class ResetFacetsProcessorTest extends UnitTestCase {
protected $processor;
public function setUp() {
parent::setUp();
$string_translation = $this
->prophesize(TranslationInterface::class);
$container = new ContainerBuilder();
$container
->set('string_translation', $string_translation
->reveal());
\Drupal::setContainer($container);
$this->processor = new ResetFacetsProcessor([
'settings' => [
'link_text' => 'Text',
],
], 'reset_facets', []);
}
public function testIsHidden() {
$this
->assertFalse($this->processor
->isHidden());
}
public function testIsLocked() {
$this
->assertFalse($this->processor
->isLocked());
}
public function testBuildWithEmptyItems() {
$summary = new FacetsSummary([], 'facets_summary');
$summary
->setFacetSourceId('foo');
$config = [
'processor_id' => 'reset_facets',
'weights' => [],
'settings' => [
'link_text' => 'Text',
],
];
$summary
->addProcessor($config);
$result = $this->processor
->build($summary, [
'foo',
], []);
$this
->assertSame('array', gettype($result));
}
}