cvsuser 06/02/24 06:33:11
Modified: App-Repository/t DBI-repobjectset.t
Log:
add max_age feature on the object set to serve as default if not provided in
get_objects({max_age => 0}) calls
Revision Changes Path
1.2 +15 -0 p5ee/App-Repository/t/DBI-repobjectset.t
Index: DBI-repobjectset.t
===================================================================
RCS file: /cvs/public/p5ee/App-Repository/t/DBI-repobjectset.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DBI-repobjectset.t 15 Nov 2005 16:49:11 -0000 1.1
+++ DBI-repobjectset.t 24 Feb 2006 14:33:11 -0000 1.2
@@ -152,6 +152,21 @@
$objset->get_unique_index(["first_name"]);
my $object = $objset->get_object("stephen");
ok($object->{age} == 39, "got stephen object (age 39)");
+
+ # max_age
+ $rep->set("test_person",1,"age",40);
+ $objects = $objset->get_objects(); # NOTE: objects are cached. we miss
the update.
+ is($objects->[0]{age}, 39, "max_age: no refresh without max_age");
+ $objects = $objset->get_objects({max_age => 100}); # NOTE: objects are
cached. we miss the update.
+ is($objects->[0]{age}, 39, "max_age: no refresh with big max_age");
+ $objects = $objset->get_objects({max_age => 0}); # NOTE: we get the
update.
+ is($objects->[0]{age}, 40, "max_age: refresh with small max_age");
+ $rep->set("test_person",1,"age",41);
+ $objset->{max_age} = 0;
+ $objects = $objset->get_objects({max_age => 100}); # NOTE: objects are
cached. we miss the update.
+ is($objects->[0]{age}, 40, "max_age: no refresh by overriding small
max_age on objset with large max_age");
+ $objects = $objset->get_objects(); # NOTE: we get the
update.
+ is($objects->[0]{age}, 41, "max_age: refresh with max_age on objset");
}
{