public function UnitTest::testAcsfEventPushPop in Acquia Cloud Site Factory Connector 8.2
Same name and namespace in other branches
- 8 tests/AcsfEventsTest.php \UnitTest::testAcsfEventPushPop()
Tests that the push and pop methods work as expected.
File
- tests/
AcsfEventsTest.php, line 63 - Provides PHPUnit tests for the Acsf Events system.
Class
Code
public function testAcsfEventPushPop() {
$classes = [
'UnitTestDummyHandler1',
'UnitTestDummyHandler2',
'UnitTestDummyHandler3',
];
$event = new AcsfEvent(new AcsfEventDispatcher(), new AcsfLog(), 'unit_test', [], []);
foreach ($classes as $class) {
$event
->pushHandler(new $class($event));
}
$debug = $event
->debug();
$this
->assertCount(3, $debug['handlers']['incomplete']);
$handlers = [];
while ($handler = $event
->popHandler()) {
$handlers[] = $handler;
}
$this
->assertCount(3, $handlers);
$this
->assertEmpty($event
->debug());
}