public function testHeadItems()
 {
     // Reenable this as it was disabled in the previous test.
     ExceptionHandler::enableExceptionTrapping();
     LayoutModule::addHeadItem("this is some html");
     LayoutModule::addHeadItem("this is more html");
     $head = LayoutModule::getHeadItemsAsHtml();
     $this->assertEquals("this is some html\nthis is more html", $head);
 }
 public function testDisablingTrapping()
 {
     ExceptionHandler::disableExceptionTrapping();
     try {
         // Enable layouts for this test as proof the URL handler has intercepted the response.
         LayoutModule::enableLayout();
         $request = new WebRequest();
         $request->UrlPath = "/test-exception/";
         $response = Module::generateResponseForRequest($request);
         $this->fail("Without exception trapping this line should not be reached.");
     } catch (RhubarbException $er) {
     }
     ExceptionHandler::setExceptionHandlerClassName('\\Rhubarb\\Crown\\Tests\\Exceptions\\Handlers\\UnitTestDisobedientExceptionHandler');
     try {
         // Enable layouts for this test as proof the URL handler has intercepted the response.
         LayoutModule::enableLayout();
         $request = new WebRequest();
         $request->UrlPath = "/test-exception/";
         $response = Module::generateResponseForRequest($request);
     } catch (RhubarbException $er) {
         $this->fail("The extended exception handler should force handling of exceptions even if trapping is disabled.");
     }
     ExceptionHandler::enableExceptionTrapping();
     LayoutModule::disableLayout();
 }
 public function testDisablingTrapping()
 {
     ExceptionHandler::disableExceptionTrapping();
     try {
         // Enable layouts for this test as proof the URL handler has intercepted the response.
         LayoutModule::enableLayout();
         $request = new WebRequest();
         $request->urlPath = "/test-exception/";
         $response = $this->application->generateResponseForRequest($request);
         $this->fail("Without exception trapping this line should not be reached.");
     } catch (RhubarbException $er) {
     }
     $this->application->container()->registerClass(ExceptionHandler::class, UnitTestDisobedientExceptionHandler::class);
     try {
         // Enable layouts for this test as proof the URL handler has intercepted the response.
         LayoutModule::enableLayout();
         $request = new WebRequest();
         $request->urlPath = "/test-exception/";
         $response = $this->application->generateResponseForRequest($request);
     } catch (RhubarbException $er) {
         $this->fail("The extended exception handler should force handling of exceptions even if trapping is disabled.");
     }
     ExceptionHandler::enableExceptionTrapping();
     LayoutModule::disableLayout();
 }