ServiceTest.php in Purge 8.3
File
tests/src/Kernel/Processor/ServiceTest.php
View source
<?php
namespace Drupal\Tests\purge\Kernel\Processor;
use Drupal\purge\Plugin\Purge\Processor\ProcessorInterface;
use Drupal\Tests\purge\Kernel\KernelServiceTestBase;
class ServiceTest extends KernelServiceTestBase {
protected $serviceId = 'purge.processors';
public static $modules = [
'purge_processor_test',
];
public function setUp($switch_to_memory_queue = TRUE) : void {
parent::setUp($switch_to_memory_queue);
$this
->installConfig([
'purge_processor_test',
]);
}
public function testCount() : void {
$this
->initializeService();
$this
->assertTrue($this->service instanceof \Countable);
$this
->assertEquals(2, count($this->service));
}
public function testGet() : void {
$this
->initializeService();
$this
->assertTrue($this->service
->get('a') instanceof ProcessorInterface);
$this
->assertTrue($this->service
->get('b') instanceof ProcessorInterface);
$this
->assertFalse($this->service
->get('c'));
$this->service
->setPluginsEnabled([
'c',
]);
$this
->assertTrue($this->service
->get('c') instanceof ProcessorInterface);
}
public function testIteration() : void {
$this
->initializeService();
$this
->assertIterator([
'a',
'b',
], '\\Drupal\\purge\\Plugin\\Purge\\Processor\\ProcessorInterface');
}
}