class ResetFacetsProcessorTest in Facets 8
Class ResetFacetsProcessorTest.
@group facets @coversDefaultClass \Drupal\facets_summary\Plugin\facets_summary\processor\ResetFacetsProcessor
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\facets_summary\Unit\Plugin\Processor\ResetFacetsProcessorTest
Expanded class hierarchy of ResetFacetsProcessorTest
File
- modules/
facets_summary/ tests/ src/ Unit/ Plugin/ Processor/ ResetFacetsProcessorTest.php, line 17
Namespace
Drupal\Tests\facets_summary\Unit\Plugin\ProcessorView source
class ResetFacetsProcessorTest extends UnitTestCase {
/**
* The processor we're testing.
*
* @var \Drupal\facets_summary\Processor\ProcessorInterface|\Drupal\facets_summary\Processor\BuildProcessorInterface
*/
protected $processor;
/**
* {@inheritdoc}
*/
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', []);
}
/**
* Tests the is hidden method.
*
* @covers ::isHidden
*/
public function testIsHidden() {
$this
->assertFalse($this->processor
->isHidden());
}
/**
* Tests the is locked method.
*
* @covers ::isLocked
*/
public function testIsLocked() {
$this
->assertFalse($this->processor
->isLocked());
}
/**
* Tests the build method.
*
* @covers ::build
*/
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));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
ResetFacetsProcessorTest:: |
protected | property | The processor we're testing. | |
ResetFacetsProcessorTest:: |
public | function |
Overrides UnitTestCase:: |
|
ResetFacetsProcessorTest:: |
public | function | Tests the build method. | |
ResetFacetsProcessorTest:: |
public | function | Tests the is hidden method. | |
ResetFacetsProcessorTest:: |
public | function | Tests the is locked method. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |