Example #1
0
 /**
  * Configure ACL to deny everything, thus the request must be dispatched
  * to the authentication controller.
  * 
  * @covers spriebsch\MVC\FrontController
  */
 public function testExecute()
 {
     $this->request = $this->getMock('spriebsch\\MVC\\Request', array(), array(), '', false, false);
     $this->response = $this->getMock('spriebsch\\MVC\\Response', array(), array(), '', false, false);
     $this->session = $this->getMock('spriebsch\\MVC\\Session', array(), array(), '', false, false);
     $this->authAdapter = $this->getMock('spriebsch\\MVC\\AuthenticationAdapter', array(), array(), '', false, false);
     $this->controllerFactory = $this->getMock('spriebsch\\MVC\\ControllerFactory', array(), array(), '', false, false);
     $this->viewFactory = $this->getMock('spriebsch\\MVC\\ViewFactory', array(), array(), '', false, false);
     $this->acl = $this->getMock('spriebsch\\MVC\\Acl', array(), array(), '', false, false);
     $this->appController = $this->getMock('spriebsch\\MVC\\ApplicationController', array(), array(), '', false, false);
     $this->view = $this->getMock('spriebsch\\MVC\\View', array(), array(), '', false, false);
     $this->controller = $this->getMock('spriebsch\\MVC\\Controller', array(), array(), '', false, false);
     // Controller's execute method must be called once and return 'success'.
     $this->controller->expects($this->once())->method('execute')->will($this->returnValue('success'));
     // View's render method must be called once.
     $this->view->expects($this->once())->method('render');
     // ->with($this->equalTo());
     // @todo request and response as parameters
     // The controller factory returns the controller object.
     $this->controllerFactory->expects($this->once())->method('getController')->will($this->returnValue($this->controller));
     // The application controller returns a controller name, class, and
     // method that we ignore anyway.
     $this->appController->expects($this->once())->method('getControllerName')->will($this->returnValue('controller'));
     $this->appController->expects($this->once())->method('getClass')->will($this->returnValue('class'));
     $this->appController->expects($this->once())->method('getMethod')->will($this->returnValue('method'));
     $this->appController->expects($this->once())->method('getView')->will($this->returnValue($this->view));
     $fc = new FrontController($this->request, $this->response, $this->session, $this->authAdapter, $this->acl, $this->appController, $this->controllerFactory);
     $fc->execute();
 }
Example #2
0
<?php

error_reporting(E_ALL ^ E_STRICT);
require_once 'utility/Timer.php';
//Timer::start('Page Request');
require_once 'boot/bootstrap.php';
$f = new FrontController();
echo $f->execute();
//Timer::stop();