ServiceTest.php in Purge 8.3
File
tests/src/Kernel/Queuer/ServiceTest.php
View source
<?php
namespace Drupal\Tests\purge\Kernel\Queuer;
use Drupal\purge\Plugin\Purge\Queuer\QueuerInterface;
use Drupal\Tests\purge\Kernel\KernelServiceTestBase;
class ServiceTest extends KernelServiceTestBase {
protected $serviceId = 'purge.queuers';
public static $modules = [
'purge_queuer_test',
];
public function setUp($switch_to_memory_queue = TRUE) : void {
parent::setUp($switch_to_memory_queue);
$this
->installConfig([
'purge_queuer_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 QueuerInterface);
$this
->assertTrue($this->service
->get('b') instanceof QueuerInterface);
$this
->assertFalse($this->service
->get('c'));
$this->service
->setPluginsEnabled([
'c',
]);
$this
->assertTrue($this->service
->get('c') instanceof QueuerInterface);
}
public function testIteration() : void {
$this
->initializeService();
$this
->assertIterator([
'a',
'b',
], '\\Drupal\\purge\\Plugin\\Purge\\Queuer\\QueuerInterface');
}
}