1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-10 00:27:45 +02:00

Issue #5480 Event function may now be static and located in other classes.

This commit is contained in:
camer0n
2025-04-25 17:09:32 -07:00
parent c9575b272d
commit cc56b22c60
4 changed files with 107 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ class e107_eventTest extends \Codeception\Test\Unit
}
catch(Exception $e)
{
$this->fail($e->getMessage());
$this::fail($e->getMessage());
}
}
@@ -25,10 +25,41 @@ class e107_eventTest extends \Codeception\Test\Unit
e107::getEvent()->trigger('user_profile_display', ['foo'=>'bar']);
$result = e107::getEvent()->triggered('user_profile_display');
$this->assertTrue($result);
$this::assertTrue($result);
$result = e107::getEvent()->triggered('non_event');
$this->assertFalse($result);
$this::assertFalse($result);
}
public function testTriggerClass()
{
e107::getPlugin()->install('_blank');
e107::getEvent()->init();
$result = e107::getEvent()->trigger('_blank_custom_class', ['foo'=>'bar']);
$expected = 'Blocking more triggers of: _blank_custom_class {"foo":"bar"}'; // @see e107_plugins/_blank/e_event.php
$this::assertSame($expected, $result);
e107::getPlugin()->uninstall('_blank');
e107::getEvent()->init();
}
public function testTriggerStatic()
{
e107::getPlugin()->install('_blank');
e107::getEvent()->init();
$result = e107::getEvent()->trigger('_blank_static_event', ['foo'=>'bar']);
$expected = 'error in event: _blank_static_event'; // @see e107_plugins/_blank/e_event.php
$this::assertSame($expected, $result);
e107::getPlugin()->uninstall('_blank');
e107::getEvent()->init();
}