Пример #1
0
 /**
  * Tests if the request object knows if the request was a post request.
  */
 public function testIsPost()
 {
     $params = array('name' => 'testuser', 'email' => '*****@*****.**', 'id' => 123);
     $_POST = $params;
     $_REQUEST = $params;
     $this->assertTrue($this->request->isPost());
 }
Пример #2
0
 /**
  * Initialize all needed objects.
  */
 public function __construct()
 {
     $this->request = new Request();
     $this->translator = new Translator();
     $this->router = new Router($this->request);
     $this->plugin = new Plugin();
     $this->view = new View($this->request, $this->translator, $this->router);
     $this->fileConfig = new Config\File();
     $this->router->execute();
     if ($this->request->isAdmin()) {
         $this->layout = new Layout\Admin($this->request, $this->translator, $this->router);
     } else {
         $this->layout = new Layout\Frontend($this->request, $this->translator, $this->router);
     }
     if ($this->request->isPost() && !$this->request->isSecure()) {
         throw new \InvalidArgumentException('no valid secure token given, add function getTokenField() to formular');
     }
     $this->plugin->detectPlugins();
     $this->plugin->addPluginData('request', $this->request);
     $this->plugin->addPluginData('layout', $this->layout);
     $this->plugin->addPluginData('router', $this->router);
 }