From f038cc9d9986dbe1437d3e3b3a2f016b96a15c5d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 4 Aug 2011 21:21:41 -0400 Subject: [PATCH] All tests pass again --- testing/tests/base/struct_test.php | 2 +- testing/tests/data/model_test.php | 36 +++++++++++++++++++++++++ testing/tests/http/rest_action_test.php | 8 +++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/testing/tests/base/struct_test.php b/testing/tests/base/struct_test.php index 8eacbaa..cab9fe7 100644 --- a/testing/tests/base/struct_test.php +++ b/testing/tests/base/struct_test.php @@ -17,7 +17,7 @@ namespace hoplite\test; use \hoplite\base as base; -require_once TEST_ROOT . '/tests/base.php'; +require_once HOPLITE_ROOT . '/base/struct.php'; class TestStruct extends base\Struct { diff --git a/testing/tests/data/model_test.php b/testing/tests/data/model_test.php index b223e35..153c7ee 100644 --- a/testing/tests/data/model_test.php +++ b/testing/tests/data/model_test.php @@ -17,6 +17,42 @@ namespace hoplite\test; use \hoplite\data as data; +require_once HOPLITE_ROOT . '/data/model.php'; + +class TestModel extends data\Model +{ + protected $table = 'test_table'; + protected $primary_key = 'id'; + protected $condition = 'id = :id'; + + protected $fields = array( + 'id', + 'title', + 'description', + 'value', + 'is_hidden', + 'reference_id' + ); + + static public function SetUpDatabase() + { + $db = new \PDO('sqlite::memory:'); + $db->SetAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + $db->Query(" + CREATE TABLE test_table + ( + id integer PRIMARY KEY AUTOINCREMENT, + title varchar(100), + description text, + value text, + is_hidden boolean, + reference_id integer + ); + "); + return $db; + } +} + class CompoundKeyModel extends data\Model { protected $table = 'test_compound'; diff --git a/testing/tests/http/rest_action_test.php b/testing/tests/http/rest_action_test.php index 6357093..4c89d14 100644 --- a/testing/tests/http/rest_action_test.php +++ b/testing/tests/http/rest_action_test.php @@ -29,22 +29,22 @@ class TestRestAction extends http\RestAction public function DoGet(http\Request $request, http\Response $response) { - parent::_DoGet($request, $response); + parent::DoGet($request, $response); $this->did_get = TRUE; } public function DoPost(http\Request $request, http\Response $response) { - parent::_DoPost($request, $response); + parent::DoPost($request, $response); $this->did_post = TRUE; } public function DoDelete(http\Request $request, http\Response $response) { - parent::_DoDelete($request, $response); + parent::DoDelete($request, $response); $this->did_delete = TRUE; } public function DoPut(http\Request $request, http\Response $response) { - parent::_DoPut($request, $response); + parent::DoPut($request, $response); $this->did_put = TRUE; } } -- 2.43.5