summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/tests/Access_Helper_Test.php17
-rw-r--r--core/tests/ORM_MPTT_Test.php10
2 files changed, 6 insertions, 21 deletions
diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php
index f629ef06..6953a21a 100644
--- a/core/tests/Access_Helper_Test.php
+++ b/core/tests/Access_Helper_Test.php
@@ -62,29 +62,18 @@ class Access_Helper_Test extends Unit_Test_Case {
public function adding_and_removing_items_adds_ands_removes_rows_test() {
$root = ORM::factory("item", 1);
- $item = ORM::factory("item");
- $item->type = "album";
- $item->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
- $item->sort_column = "id";
- $item->sort_order = "ASC";
-
- $item->add_to_parent($root);
-
- // Simulate an event
- access::add_item($item);
+ $item = album::create($root, rand(), "test album");
// New rows exist
$this->assert_true(ORM::factory("access_cache")->where("item_id", $item->id)->find()->loaded);
$this->assert_true(ORM::factory("access_intent")->where("item_id", $item->id)->find()->loaded);
- // Simulate a delete event
- access::delete_item($item);
+ // Delete the item
+ $item->delete();
// Rows are gone
$this->assert_false(ORM::factory("access_cache")->where("item_id", $item->id)->find()->loaded);
$this->assert_false(ORM::factory("access_intent")->where("item_id", $item->id)->find()->loaded);
-
- $item->delete();
}
public function new_photos_inherit_parent_permissions_test() {
diff --git a/core/tests/ORM_MPTT_Test.php b/core/tests/ORM_MPTT_Test.php
index 7109d43b..2aeea58c 100644
--- a/core/tests/ORM_MPTT_Test.php
+++ b/core/tests/ORM_MPTT_Test.php
@@ -20,12 +20,7 @@
class ORM_MPTT_Test extends Unit_Test_Case {
private function create_item_and_add_to_parent($parent) {
- $album = ORM::factory("item");
- $album->type = "album";
- $album->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
- $album->sort_column = "id";
- $album->sort_order = "ASC";
- $album->add_to_parent($parent);
+ $album = album::create($parent, rand(), "test album");
return $album;
}
@@ -141,7 +136,8 @@ class ORM_MPTT_Test extends Unit_Test_Case {
$inner1 = self::create_item_and_add_to_parent($outer);
$inner2 = self::create_item_and_add_to_parent($outer);
- $this->assert_equal(array($inner2->id => null), $outer->children(1, 1)->select_list('id'));
+ $this->assert_equal(array($inner2->id => $inner2->name),
+ $outer->children(1, 1)->select_list('id'));
}
public function children_count_test() {