public function testIndexAction() { $view = $this->getServiceMockBuilder('FooView')->getMock(); $view->expects($this->once())->method('setTemplate')->with('FooBundle:Default:index.twig')->will($this->returnValue(null)); $view->expects($this->once())->method('handle')->with()->will($this->returnValue('success')); $controller = new DefaultController($view); $this->assertEquals('success', $controller->indexAction()); }
public function indexAction($message = NULL) { parent::indexAction($message); $this->view->pick("projects/index"); $this->jquery->exec("\$('[data-toggle=\"tooltip\"]').tooltip()", true); $this->jquery->getOnClick(".update, .add", "", "#content", array("attr" => "data-ajax")); $this->jquery->compile($this->view); }
public function testHelloWorld() { /** * @var \Waddle\Classes\App $app */ $app = $this->getMockBuilder('Waddle\\Classes\\App')->disableOriginalConstructor()->getMock(); $controller = new DefaultController($app); $this->expectOutputRegex('/<h1>Hello, World!<\\/h1>/'); $controller->indexAction('World!'); }
public function dispatch() { $flag = false; if (isset($_GET['ctrl'], $_GET['act'])) { $ctrlName = "Imie\\Controllers\\" . ucfirst($_GET['ctrl']) . 'Controller'; if (class_exists($ctrlName)) { $ctrl = new $ctrlName(); $actName = $_GET['act'] . 'Action'; if (method_exists($ctrl, $actName)) { $ctrl->{$actName}(); $flag = true; } } } if (!$flag) { $controller = new DefaultController(); $controller->indexAction(); } }