X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Funit_core_mvc.t;h=9229ee7ccd2af582d06762be34569f4a95ca52fa;hp=d5dfb7ed98b6bf1899881e21f08ccc215ebed1f4;hb=72f87c4bec018bc59ef69db7c55b9a8d68bb503d;hpb=fa0fae2a650b703a81007ba43abdace05a04b76c diff --git a/t/unit_core_mvc.t b/t/unit_core_mvc.t index d5dfb7e..9229ee7 100644 --- a/t/unit_core_mvc.t +++ b/t/unit_core_mvc.t @@ -1,4 +1,4 @@ -use Test::More tests => 23; +use Test::More tests => 27; use strict; use warnings; @@ -73,6 +73,20 @@ is ( bless ({stash=>{current_model_instance=> $model, current_model=>'MyApp::M:: MyApp->config->{default_view} = 'V'; is ( bless ({stash=>{}}, 'MyApp')->view , 'MyApp::View::V', 'default_view ok'); +is ( MyApp->view , 'MyApp::View::V', 'default_view in class method ok'); MyApp->config->{default_model} = 'M'; is ( bless ({stash=>{}}, 'MyApp')->model , 'MyApp::Model::M', 'default_model ok'); +is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok'); + +#checking @args passed to ACCEPT_CONTEXT +my $args; +{ + no warnings; + *MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; + *MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; +} +MyApp->model('M', qw/foo bar/); +is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok'); +MyApp->view('V', qw/baz moo/); +is_deeply($args, [qw/baz moo/], '$c->view args passed to ACCEPT_CONTEXT ok');