root/branches/release-41/t/mt_cms_tag.t @ 2711

Revision 2711, 1.1 kB (checked in by bchoate, 17 months ago)

Fixed expected results to match test data.

Line 
1#!/usr/bin/perl -w
2
3use strict;
4use warnings;
5
6use lib 't/lib';
7use MT::Test qw(:cms :db :data);
8
9use Test::More;
10
11
12plan tests => 10;
13
14{
15    diag('test MT::CMS::Blog::list_tag_for()');
16
17    isa_ok(MT->instance, 'MT::App::CMS', 'our mt app');
18
19    require MT::CMS::Tag;
20    MT->instance->user(MT->model('author')->load(1));
21    my $ret = MT::CMS::Tag::list_tag_for(MT->instance,
22        TagObjectType => 'entry',
23        Package       => MT->model('entry'),
24    );
25    ok($ret, 'yay finished');
26    diag('ERROR: ' . MT->instance->errstr) if !$ret;
27
28    isa_ok($ret, 'MT::Template', 'list_tag_for() result');
29    my $loop = $ret->param('object_loop');
30    ok($loop, 'list_tag_for() result has an object_loop');
31    isa_ok($loop, 'ARRAY', 'result object_loop is really a loop');
32    isa_ok($loop->[0], 'HASH', 'result object_loop is a loop of hashrefs');
33
34    is(scalar @$loop, 5, 'result object_loop has six objects');
35    is($loop->[0]->{tag_name}, 'anemones', 'first tag in loop is anemones');
36    is($loop->[1]->{tag_name}, 'grandpa', 'third tag in loop is grandpa');
37    is($loop->[2]->{tag_name}, 'rain', 'fourth tag in loop is rain');
38}
39
401;
41
Note: See TracBrowser for help on using the browser.