public testCanRegisterFunctionsAsPageHandlers ( ) |
function testCanRegisterFunctionsAsPageHandlers()
{
$registered = $this->router->registerPageHandler('hello', array($this, 'hello_page_handler'));
$this->assertTrue($registered);
$path = "hello/1/€";
// euro sign
ob_start();
$handled = $this->router->route($this->prepareHttpRequest($path));
ob_end_clean();
$this->assertTrue($handled);
$response = _elgg_services()->responseFactory->getSentResponse();
$this->assertInstanceOf(Response::class, $response);
$this->assertEquals($path, $response->getContent());
$this->assertEquals(array('hello' => array($this, 'hello_page_handler')), $this->router->getPageHandlers());
}