getPageHandlers() public method

Get page handlers as array of identifier => callback
public getPageHandlers ( ) : array
return array
Exemplo n.º 1
0
 function testCanRegisterFunctionsAsPageHandlers()
 {
     $registered = $this->router->registerPageHandler('hello', array($this, 'hello_page_handler'));
     $this->assertTrue($registered);
     $path = "hello/1/€";
     // euro sign
     $qs = http_build_query(array(Application::GET_PATH_KEY => $path));
     $request = \Elgg\Http\Request::create("http://localhost/?{$qs}");
     ob_start();
     $handled = $this->router->route($request);
     $output = ob_get_clean();
     $this->assertTrue($handled);
     $this->assertEquals($path, $output);
     $this->assertEquals(array('hello' => array($this, 'hello_page_handler')), $this->router->getPageHandlers());
 }
Exemplo n.º 2
0
 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());
 }