Show
Ignore:
Timestamp:
04/24/08 22:43:21 (19 months ago)
Author:
mpaschal
Message:

Split these tests up (can't instantiate two MTs in one run)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-36/t/21-callbacks.t

    r1459 r2069  
    44use warnings; 
    55 
    6 use Test::More tests => 8; 
     6use Test::More tests => 5; 
    77use CGI; 
    88use DB_File; 
     9 
     10use lib 'extlib'; 
     11use lib 't/lib'; 
     12use lib 'lib'; 
    913 
    1014use MT; 
     
    9195=cut 
    9296 
    93 ### Test app callbacks 
    94  
    95 my @result_cats = (); 
    96  
    97 my $cms = MT::App::CMS->new(Config => $T_CFG); 
    98  
    99 my $app_post_save_called; 
    100 MT->add_callback('AppPostEntrySave', 1, $plugin,  
    101                  sub {  
    102                        $app_post_save_called = 1; 
    103                        my @plcmts = MT::Placement->load({entry_id => $_[2]->id}); 
    104                        for my $plcmt (@plcmts) { 
    105                            push @result_cats, $plcmt->category_id; 
    106                        } 
    107                    } ); 
    108  
    109 MT::unplug(); 
    110 my $q = CGI->new(); 
    111 #$q->param(id => $entry2->id); 
    112 $q->param(blog_id => $entry2->blog_id); 
    113 $q->param(category_ids => 17); 
    114 # $q->param(username => 'Chuck D'); 
    115 # $q->param(password => 'bass'); 
    116 $q->param(text => "Buddha blessed and boo-ya blasted;  
    117 these are the words that she manifested."); 
    118 $cms->{query} = $q; 
    119 $cms->{perms} = MT::Permission->new(); 
    120 $cms->{perms}->can_post(1); 
    121 $cms->{author} = MT::Author->new(); 
    122 $cms->{author}->name("Mel E. Mel"); 
    123 $cms->{author}->id(1); 
    124  
    125 # fake out the magic; we're not testing that right now 
    126 no warnings qw(once redefine); 
    127 *MT::App::CMS::validate_magic = sub { 1; }; 
    128 use warnings qw(once redefine); 
    129  
    130 my $handler = $cms->handler_to_coderef( $cms->handlers_for_mode('save_entry') ); 
    131 my $ret = $handler->($cms); 
    132 ok(!defined $ret && $cms->{redirect}, 'entry save was successful'); 
    133 diag('Error: ' . $cms->errstr) if !defined $ret && !$cms->{redirect}; 
    134  
    135 ok($app_post_save_called, 'AppPostEntrySave callback was called'); 
    136 is($result_cats[0], 17, 'result_cats = 17'); 
    137