[Catalyst-commits] r8337 - Catalyst-Runtime/5.80/trunk/t

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Wed Sep 3 07:03:36 BST 2008


Author: rafl
Date: 2008-09-03 07:03:36 +0100 (Wed, 03 Sep 2008)
New Revision: 8337

Modified:
   Catalyst-Runtime/5.80/trunk/t/unit_core_component.t
   Catalyst-Runtime/5.80/trunk/t/unit_core_mvc.t
Log:
Fix ACCEPT_COMPONENT tests.

As of r8334 MyApp->component doesn't invoke ACCEPT_COMPONENT anymore.

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_component.t	2008-09-03 05:59:30 UTC (rev 8336)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_component.t	2008-09-03 06:03:36 UTC (rev 8337)
@@ -73,16 +73,20 @@
 {
     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};
+    }
 
-    MyApp->component('MyApp::M::Model', qw/foo bar/);
+    my $c = bless {}, 'MyApp';
+
+    $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');
 } 
 

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_mvc.t	2008-09-03 05:59:30 UTC (rev 8336)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_mvc.t	2008-09-03 06:03:36 UTC (rev 8337)
@@ -150,17 +150,21 @@
 {
     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};
+    }
 
-    MyApp->model('M', qw/foo bar/);
+    my $c = bless {}, 'MyApp';
+
+    $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');
 }




More information about the Catalyst-commits mailing list