unregisterPageHandler() public method

Unregister a page handler for an identifier
public unregisterPageHandler ( string $identifier ) : void
$identifier string The page type identifier
return void
Example #1
0
 function testCanUnregisterPageHandlers()
 {
     $this->router->registerPageHandler('hello', array($this, 'hello_page_handler'));
     $this->router->unregisterPageHandler('hello');
     $request = \Elgg\Http\Request::create('http://localhost/hello/');
     ob_start();
     $handled = $this->router->route($request);
     $output = ob_get_clean();
     // Normally we would expect the router to return false for this request,
     // but since it checks for headers_sent() and PHPUnit issues output before
     // this test runs, the headers have already been sent. It's enough to verify
     // that the output we buffered is empty.
     // $this->assertFalse($handled);
     $this->assertEmpty($output);
 }
Example #2
0
 function testCanUnregisterPageHandlers()
 {
     $this->router->registerPageHandler('hello', array($this, 'hello_page_handler'));
     $this->router->unregisterPageHandler('hello');
     ob_start();
     $this->router->route($this->prepareHttpRequest('hello'));
     $output = ob_get_clean();
     $response = _elgg_services()->responseFactory->getSentResponse();
     $this->assertFalse($response);
     // Normally we would expect the router to return false for this request,
     // but since it checks for headers_sent() and PHPUnit issues output before
     // this test runs, the headers have already been sent. It's enough to verify
     // that the output we buffered is empty.
     // $this->assertFalse($handled);
     $this->assertEmpty($output);
 }