From 630b0f26fc5dc970d8634e58489c41c5a40481f1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 4 Nov 2008 05:02:37 +0000 Subject: Restructure the theme code to be more like WordPress / Habari. Now, the controller initiates a request to a top level page (eg: album.html.php) which is then free to include whatever other page chunks it wants with calls like display('header.html') ?> Variables like $item and $children are in the global space for all views. theme.php helper is now Theme.php library which lets us store the name of the theme inside the variable itself. This means that the theme does not have to know its own name because you can use $theme->url() for all urls to stuff inside the theme itself, which makes it possible to cline a theme without changing a single line. Still using the mock album UI. --- core/tests/Theme_Test.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'core/tests') diff --git a/core/tests/Theme_Test.php b/core/tests/Theme_Test.php index 5b568b19..f73a98eb 100644 --- a/core/tests/Theme_Test.php +++ b/core/tests/Theme_Test.php @@ -19,16 +19,22 @@ */ class Theme_Test extends Unit_Test_Case { - public function teardown() { - theme::$debug_backtrace = "debug_backtrace"; + public function url_test() { + $theme = new Theme("fake_theme"); + $this->assert_equal("http://./themes/fake_theme/file", $theme->url("file")); } - public function url_test() { - theme::$debug_backtrace = array("Theme_Test", "_fake_debug_backtrace"); - $this->assert_equal("http://./themes/fake_theme/file", theme::url("file")); + public function display_test() { + $theme = new Theme("fake_theme"); + $view = $theme->display("test_page", "Theme_Test_Mock_View"); + $this->assert_equal("test_page", $view->page_name); } +} + +class Theme_Test_Mock_View { + public $page_name = null; - public function _fake_debug_backtrace() { - return array(array(), array('file' => THEMEPATH . "fake_theme/views/some_file.html.php")); + public function __construct($page_name) { + $this->page_name = $page_name; } } \ No newline at end of file -- cgit v1.2.3