TomeStaticEventTestBase.php in Tome 8
File
modules/tome_static/tests/src/Kernel/TomeStaticEventTestBase.php
View source
<?php
namespace Drupal\Tests\tome_static\Kernel;
use Drupal\KernelTests\KernelTestBase;
abstract class TomeStaticEventTestBase extends KernelTestBase {
protected $eventName;
public static $modules = [
'tome_static',
];
protected $eventDispatcher;
public function setUp() {
parent::setUp();
$this->eventDispatcher = \Drupal::service('event_dispatcher');
$listeners = $this->eventDispatcher
->getListeners($this->eventName);
foreach ($listeners as $listener) {
$this->eventDispatcher
->removeListener($this->eventName, $listener);
}
}
protected function assertUnsortedEquals(array $array1, array $array2) {
sort($array1);
sort($array2);
$this
->assertEquals($array1, $array2);
}
}