X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_component.t;h=53d6567815ecf20616e1669306128f3d5ca7bf5e;hb=05b47f2e6357bc7f1622e6b2cf730ad5bbeb993f;hp=250960a1fca16c3d858391651700aba227dad668;hpb=aa61c19093ccde10f79f746daee1387748590f43;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_component.t b/t/unit_core_component.t index 250960a..53d6567 100644 --- a/t/unit_core_component.t +++ b/t/unit_core_component.t @@ -59,8 +59,9 @@ is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok'); # multiple returns { - my @expected = qw( MyApp::C::Controller MyApp::M::Model ); - is_deeply( [ MyApp->comp( qr{::[MC]::} ) ], \@expected, 'multiple results fro regexp ok' ); + my @expected = sort qw( MyApp::C::Controller MyApp::M::Model ); + my @got = sort MyApp->comp( qr{::[MC]::} ); + is_deeply( \@got, \@expected, 'multiple results from regexp ok' ); } # failed search @@ -73,16 +74,20 @@ is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok'); { my $args; - no warnings; - *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; + { + no warnings 'once'; + *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args}; + } + + my $c = bless {}, 'MyApp'; - MyApp->component('MyApp::M::Model', qw/foo bar/); + $c->component('MyApp::M::Model', qw/foo bar/); is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok'); - MyApp->component('M::Model', qw/foo2 bar2/); + $c->component('M::Model', qw/foo2 bar2/); is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok'); - MyApp->component('Mode', qw/foo3 bar3/); + $c->component('Mode', qw/foo3 bar3/); is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok'); }