From ffb88b021706fc548c75a580761e5c47e5537192 Mon Sep 17 00:00:00 2001 From: Zcasper Date: Tue, 8 Mar 2016 03:33:16 +0600 Subject: [PATCH] wantfix --- bootstrap.php | 3 ++- micro/Micro.php | 2 +- micro/mvc/controllers/RichController.php | 2 ++ micro/mvc/views/PhpView.php | 7 ++--- micro/tests/HelloTest.php | 33 ++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 micro/tests/HelloTest.php diff --git a/bootstrap.php b/bootstrap.php index 2978b01..8e1d4aa 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,7 +1,8 @@ doException($e); // run exception + return $this->doException($e); } } diff --git a/micro/mvc/controllers/RichController.php b/micro/mvc/controllers/RichController.php index 55d8a86..f436575 100644 --- a/micro/mvc/controllers/RichController.php +++ b/micro/mvc/controllers/RichController.php @@ -48,6 +48,8 @@ public function __construct(IContainer $container, $modules = '') public function action($name = 'index') { $actionClass = false; + + // check action exists if (!method_exists($this, 'action' . ucfirst($name)) && !$actionClass = $this->getActionClassByName($name)) { $this->response->setStatus(500, 'Action "' . $name . '" not found into ' . get_class($this)); diff --git a/micro/mvc/views/PhpView.php b/micro/mvc/views/PhpView.php index b7a33b9..8d11e01 100644 --- a/micro/mvc/views/PhpView.php +++ b/micro/mvc/views/PhpView.php @@ -86,11 +86,8 @@ public function render() public function renderRawData($data = '') { $layoutPath = null; - if ($this->layout) { - $layoutPath = $this->getLayoutFile($this->container->kernel->getAppDir(), $this->module); - if (!$layoutPath) { - $this->container->logger->send('error', 'Layout `' . $this->layout . '` not found'); - } + if ($this->layout && (!$layoutPath = $this->getLayoutFile($this->container->kernel->getAppDir(), $this->module))) { + $this->container->logger->send('error', 'Layout `' . $this->layout . '` not found'); } if ($layoutPath) { diff --git a/micro/tests/HelloTest.php b/micro/tests/HelloTest.php new file mode 100644 index 0000000..86dfc39 --- /dev/null +++ b/micro/tests/HelloTest.php @@ -0,0 +1,33 @@ + + * @link https://github.com/lugnsk/micro + * @copyright Copyright © 2013 Oleg Lunegov + * @license /LICENSE + * @package Micro + * @subpackage Tests + * @version 1.0 + * @since 1.0 + */ +class HelloTest extends TestCase +{ + public function up() + { + // + } + + public function down() + { + // + } + + public function testHello() + { + $this->assertEquals('200 Ok', '200 Ok'); + } +}