Changeset 2681
- Timestamp:
- 07/02/08 22:53:21 (20 months ago)
- Files:
-
- 1 modified
-
branches/release-41/t/48-cache.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-41/t/48-cache.t
r1098 r2681 2 2 3 3 use lib 't/lib', 'extlib', 'lib', '../lib', '../extlib'; 4 use Test::More tests => 9;4 use Test::More tests => 8; 5 5 6 use vars qw($T_CFG);7 6 use MT::Test qw(:db :data); 8 9 10 $T_CFG = -r 't/mysql.cfg' ? 't/mysql.cfg' : $ENV{HOME} .'/mysql-test.cfg';11 $T_CFG = -r 't/mt.cfg' ? 't/mt.cfg' : $ENV{HOME} .'/mt-test.cfg';12 13 7 use MT; 14 8 15 9 require MT::Category; 16 10 my $cat_cache = MT::Category->cache(blog_id => 1); 17 ok($cat_cache );11 ok($cat_cache, "category cache exists for blog id 1"); 18 12 19 13 # make sure order is consistent … … 21 15 22 16 # check one of the elements 23 is($cat_cache->[0][0], '2' );24 is($cat_cache->[0][1], 'bar' );25 is($cat_cache->[0][2], '0' );17 is($cat_cache->[0][0], '2', "category id is 2"); 18 is($cat_cache->[0][1], 'bar', "category name is 'bar'"); 19 is($cat_cache->[0][2], '0', "no parent for 'bar' category"); 26 20 27 21 require MT::Tag; 28 22 my $tag_cache = MT::Tag->cache(blog_id => 1, class => 'MT::Entry'); 29 ok($tag_cache );23 ok($tag_cache, "tag cache exists for blog id 1"); 30 24 31 is($tag_cache->{grandpa}, 1); 32 is($tag_cache->{verse}, MT::Object->driver->can('count_group_by') ? 5 : 1); 25 is(@$tag_cache, 5, "number of tags in cache is 5"); # relies on test data 33 26 34 27 my $entry = MT::Entry->load(1); … … 37 30 38 31 $tag_cache = MT::Tag->cache(blog_id => 1, class => 'MT::Entry'); 39 is($tag_cache->{newtag}, 1);32 ok(grep('newtag', @$tag_cache), "newtag is in cache"); 40 33 41 34 my $cat = new MT::Category; … … 46 39 my $new_cat_cache_count = (scalar @$cat_cache) + 1; 47 40 $cat_cache = MT::Category->cache(blog_id => 1); 48 is((scalar @$cat_cache), $new_cat_cache_count );41 is((scalar @$cat_cache), $new_cat_cache_count, "category cache count incremented"); 49 42 50 43 1;
