Changeset 2681

Show
Ignore:
Timestamp:
07/02/08 22:53:21 (20 months ago)
Author:
bchoate
Message:

Fixes for cache tests.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/t/48-cache.t

    r1098 r2681  
    22 
    33use lib 't/lib', 'extlib', 'lib', '../lib', '../extlib'; 
    4 use Test::More tests => 9; 
     4use Test::More tests => 8; 
    55 
    6 use vars qw($T_CFG); 
    76use 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  
    137use MT; 
    148 
    159require MT::Category; 
    1610my $cat_cache = MT::Category->cache(blog_id => 1); 
    17 ok($cat_cache); 
     11ok($cat_cache, "category cache exists for blog id 1"); 
    1812 
    1913# make sure order is consistent 
     
    2115 
    2216# 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'); 
     17is($cat_cache->[0][0], '2', "category id is 2"); 
     18is($cat_cache->[0][1], 'bar', "category name is 'bar'"); 
     19is($cat_cache->[0][2], '0', "no parent for 'bar' category"); 
    2620 
    2721require MT::Tag; 
    2822my $tag_cache = MT::Tag->cache(blog_id => 1, class => 'MT::Entry'); 
    29 ok($tag_cache); 
     23ok($tag_cache, "tag cache exists for blog id 1"); 
    3024 
    31 is($tag_cache->{grandpa}, 1); 
    32 is($tag_cache->{verse}, MT::Object->driver->can('count_group_by') ? 5 : 1); 
     25is(@$tag_cache, 5, "number of tags in cache is 5"); # relies on test data 
    3326 
    3427my $entry = MT::Entry->load(1); 
     
    3730 
    3831$tag_cache = MT::Tag->cache(blog_id => 1, class => 'MT::Entry'); 
    39 is($tag_cache->{newtag}, 1); 
     32ok(grep('newtag', @$tag_cache), "newtag is in cache"); 
    4033 
    4134my $cat = new MT::Category; 
     
    4639my $new_cat_cache_count = (scalar @$cat_cache) + 1; 
    4740$cat_cache = MT::Category->cache(blog_id => 1); 
    48 is((scalar @$cat_cache), $new_cat_cache_count); 
     41is((scalar @$cat_cache), $new_cat_cache_count, "category cache count incremented"); 
    4942 
    50431;