From c284c8a26c9b09e10cd3af88a1c5a4770dee522e Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 13 Oct 2016 16:33:42 +0200 Subject: [PATCH] Allow controller to be initialized in test without having to instantiate Grav --- classes/controller.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/controller.php b/classes/controller.php index 518198c1..0c9b5548 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -92,7 +92,7 @@ class AdminController * @param string $route * @param array $post */ - public function __construct(Grav $grav, $view, $task, $route, $post) + public function __construct(Grav $grav = null, $view = null, $task = null, $route = null, $post = null) { $this->grav = $grav; $this->view = $view; @@ -107,7 +107,9 @@ class AdminController $this->post = $this->getPost($post); $this->route = $route; $this->admin = $this->grav['admin']; - $this->uri = $this->grav['uri']->url(); + if ($this->grav['uri']) { + $this->uri = $this->grav['uri']->url(); + } } /**