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=0953e2cb338de4c5fe63ab2f346d31f1a8a1bd6e;hp=f64101454495900da0323312dd2827a312a7be0f;hb=ae29b412955743885e80350085167b54b69672da;hpb=e16a6c4e6c4d49e73b5286b3186616af14f3f554 diff --git a/t/unit_core_mvc.t b/t/unit_core_mvc.t index f641014..0953e2c 100644 --- a/t/unit_core_mvc.t +++ b/t/unit_core_mvc.t @@ -150,22 +150,28 @@ is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok'); { 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}; + { + no warnings 'once'; + *MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; + *MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; + } + + my $c = bless {}, 'MyApp'; # test accept-context with class rather than instance MyApp->model('M', qw/foo bar/); - is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok'); + is_deeply($args, [qw/foo bar/], 'MyApp->model args passed to ACCEPT_CONTEXT ok'); - MyApp->model('M', qw/foo bar/); + $c->model('M', qw/foo bar/); is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok'); - my $x = MyApp->view('V', qw/foo2 bar2/); + my $x = $c->view('V', qw/foo2 bar2/); is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok'); # regexp fallback - MyApp->view('::View::V', qw/foo3 bar3/); + $c->view('::View::V', qw/foo3 bar3/); is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok'); + + }