ServiceSmokeAndFireTest.php in Purge 8.3
File
tests/src/Kernel/DiagnosticCheck/ServiceSmokeAndFireTest.php
View source
<?php
namespace Drupal\Tests\purge\Kernel\DiagnosticCheck;
use Drupal\purge\Plugin\Purge\DiagnosticCheck\DiagnosticCheckInterface;
use Drupal\Tests\purge\Kernel\KernelServiceTestBase;
class ServiceSmokeAndFireTest extends KernelServiceTestBase {
protected $serviceId = 'purge.diagnostics';
public static $modules = [
'purge_purger_test',
'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 testIsSystemOnFireReturnsFalse() : void {
$this
->initializePurgersService([
'ida' => 'a',
]);
$this
->initializeService();
$this
->assertFalse(is_object($this->service
->isSystemOnFire()));
$this
->assertEquals($this->service
->isSystemOnFire(), FALSE);
}
public function testIsSystemOnFireReturnsCheck() : void {
$this
->initializePurgersService([]);
$this
->initializeService();
$fire = $this->service
->isSystemOnFire();
$this
->assertTrue(is_object($fire));
if (is_object($fire)) {
$this
->assertTrue($fire instanceof DiagnosticCheckInterface);
}
}
public function testIsSystemShowingSmokeReturnsFalse() : void {
$this
->initializePurgersService([
'idb' => 'b',
]);
$this
->initializeService();
$smoke = $this->service
->isSystemShowingSmoke();
$this
->assertTrue(is_object($smoke));
if (is_object($smoke)) {
$this
->assertTrue($smoke instanceof DiagnosticCheckInterface);
}
}
}