summaryrefslogtreecommitdiff
path: root/core/tests
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-02-26 20:43:56 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-02-26 20:43:56 +0000
commit8d59f5b5fba5c494ea0e3276b69d687cb12b8f05 (patch)
tree0f2d7cf6a42881d728768ba0e75c552498d114fb /core/tests
parent95a18420342396de119090da9131ff4e417ba42d (diff)
Removed raw update sql and replaced it with Database::update(...)
calls. (ticket #68)
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Core_Installer_Test.php7
-rw-r--r--core/tests/Item_Model_Test.php5
2 files changed, 7 insertions, 5 deletions
diff --git a/core/tests/Core_Installer_Test.php b/core/tests/Core_Installer_Test.php
index 1cfd09cb..89fe1f8e 100644
--- a/core/tests/Core_Installer_Test.php
+++ b/core/tests/Core_Installer_Test.php
@@ -37,9 +37,12 @@ class Core_Installer_Test extends Unit_Test_Case {
}
public function install_creates_root_item_test() {
- $max_right =
- Database::instance()->query("SELECT MAX(`right`) AS `right` FROM items")->current()->right;
+ //$max_right =
+ // Database::instance()->query("SELECT MAX(`right`) AS `right` FROM items")->current()->right;
+ $max_right = ORM::factory("item")
+ ->select("MAX(`right`) AS `right`")
+ ->find()->right;
$root = ORM::factory('item')->find(1);
$this->assert_equal("Gallery", $root->title);
$this->assert_equal(1, $root->left);
diff --git a/core/tests/Item_Model_Test.php b/core/tests/Item_Model_Test.php
index e7c48917..449e42c3 100644
--- a/core/tests/Item_Model_Test.php
+++ b/core/tests/Item_Model_Test.php
@@ -42,8 +42,7 @@ class Item_Model_Test extends Unit_Test_Case {
// Force the creation date to something well known
$db = Database::instance();
- $db->query("UPDATE `items` SET `created` = 0 WHERE `id` = $item->id");
- $db->query("UPDATE `items` SET `updated` = 0 WHERE `id` = $item->id");
+ $db->update("items", array("created" => 0, "updated" => 0), array("id" => $item->id));
$item->reload();
$item->title = "foo"; // force a change
$item->save();
@@ -59,7 +58,7 @@ class Item_Model_Test extends Unit_Test_Case {
// Force the updated date to something well known
$db = Database::instance();
- $db->query("UPDATE `items` SET `updated` = 0 WHERE `id` = $item->id");
+ $db->update("items", array("updated" => 0), array("id" => $item->id));
$item->reload();
$item->view_count++;
$item->save();