Exemplo n.º 1
0
 /**
  * Runs the error controller action for the specified HTTP error code.
  *
  * @param int $errorCode   The error code
  *
  * @return void
  */
 protected function runErrorAction($errorCode)
 {
     $controllerName = $this->config->get('system.errorController', self::DEFAULT_ERROR_CONTROLLER_NAME);
     try {
         try {
             $controller = $this->diContainer->getController($controllerName, $this->request, $this->response);
         } catch (ControllerException $exception) {
             // No such controller, fall back to built in default
             $controller = $this->diContainer->getDefaultErrorController($this->request, $this->response);
             $controllerName = self::DEFAULT_ERROR_CONTROLLER_NAME;
         }
     } catch (\Exception $e) {
         $this->dispatchedController = $controllerName;
         $this->dispatchedAction = 500;
         throw $e;
     }
     $this->dispatchedController = $controllerName;
     $this->dispatchedAction = $errorCode;
     $this->raiseEventIfNotRaisedYet(Event::TYPE_APPLICATION_BEFORE_CONTROLLER_RUN);
     $controller->run($errorCode);
     $this->raiseEventIfNotRaisedYet(Event::TYPE_APPLICATION_AFTER_CONTROLLER_RUN);
     $this->response->render();
     $this->raiseEventIfNotRaisedYet(Event::TYPE_APPLICATION_BEFORE_OUTPUT_SEND);
     $this->response->send();
     $this->raiseEventIfNotRaisedYet(Event::TYPE_APPLICATION_AFTER_OUTPUT_SEND);
 }
Exemplo n.º 2
0
 /**
  * Test configuration section handling
  */
 public function testSections()
 {
     $testData = array('test.first' => 1, 'test.second' => 2, 'test.secondLevel.first' => 'first', 'test.secondLevel.second' => 'second', 'test2' => 'test');
     $this->config->set($testData);
     $this->assertSame(false, $this->config->get('test*', false), 'Returning invalid wildcard returns the default');
     $result = $this->config->get('test.*');
     $this->assertInternalType('array', $result);
     $this->assertEquals(4, count($result));
     $this->assertArrayHasKey('first', $result);
     $this->assertSame(1, $result['first']);
     $result = $this->config->get('test.*', null, true);
     $this->assertInternalType('array', $result);
     $this->assertEquals(4, count($result));
     $this->assertArrayHasKey('test.first', $result);
     $this->assertSame(1, $result['test.first']);
 }