Elgg\HooksRegistrationServiceTest::testCanRegisterHandlers PHP Method

testCanRegisterHandlers() public method

    public function testCanRegisterHandlers()
    {
        $f = function () {
        };
        $this->assertTrue($this->mock->registerHandler('foo', 'bar', 'callback1'));
        $this->assertTrue($this->mock->registerHandler('foo', 'bar', $f));
        $this->assertTrue($this->mock->registerHandler('foo', 'baz', 'callback3', 100));
        $expected = ['foo' => ['bar' => [500 => ['callback1', $f]], 'baz' => [100 => ['callback3']]]];
        $this->assertSame($expected, $this->mock->getAllHandlers());
        // check possibly invalid callbacks
        $this->assertFalse($this->mock->registerHandler('foo', 'bar', 1234));
    }