X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_mvc.t;h=0dbbd80df6a815af9915016da2796fd99c81409f;hb=f3414019f472b55682ef3af53f761b6db7955887;hp=d5dfb7ed98b6bf1899881e21f08ccc215ebed1f4;hpb=a3b71f0f7e3a6debf22ce742c206f2c3d249c199;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_mvc.t b/t/unit_core_mvc.t index d5dfb7e..0dbbd80 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');