[Catalyst-commits] r11803 - Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Nov 12 01:39:58 GMT 2009


Author: t0m
Date: 2009-11-12 01:39:56 +0000 (Thu, 12 Nov 2009)
New Revision: 11803

Modified:
   Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_core_mvc.t
   Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_load_catalyst_test.t
Log:
Patch up changes to tests into new location. This merges parts of the following commits which were missed by svk:

-r11456:11457 http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk
-r11467:11468 http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk


Modified: Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_core_mvc.t	2009-11-12 01:19:45 UTC (rev 11802)
+++ Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_core_mvc.t	2009-11-12 01:39:56 UTC (rev 11803)
@@ -1,4 +1,4 @@
-use Test::More tests => 46;
+use Test::More tests => 51;
 use strict;
 use warnings;
 
@@ -181,3 +181,47 @@
 
 
 }
+
+{
+    my $warn = '';
+    no warnings 'redefine';
+    local *Catalyst::Log::warn = sub { $warn .= $_[1] };
+
+    is_deeply (MyMVCTestApp->controller('MyMVCTestApp::Controller::C'),
+        MyMVCTestApp->components->{'MyMVCTestApp::Controller::C'},
+        'controller by fully qualified name ok');
+
+    # You probably meant $c->controller('C') instead of $c->controller({'MyMVCTestApp::Controller::C'})
+    my ($suggested_comp_name, $orig_comp_name) = $warn =~ /You probably meant (.*) instead of (.*) /;
+    isnt($suggested_comp_name, $orig_comp_name, 'suggested fix in warning for fully qualified component names makes sense' );
+}
+
+{
+    package MyApp::WithoutRegexFallback;
+
+    use base qw/Catalyst/;
+
+    __PACKAGE__->config( { disable_component_resolution_regex_fallback => 1 } );
+
+    __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) }
+        qw/MyApp::WithoutRegexFallback::Controller::Another::Foo/ } );
+
+    # allow $c->log->warn to work
+    __PACKAGE__->setup_log;
+}
+
+{
+    # test if non-regex component retrieval still works
+    is( MyApp::WithoutRegexFallback->controller('Another::Foo'),
+        'MyApp::WithoutRegexFallback::Controller::Another::Foo', 'controller Another::Foo found');
+}
+
+{
+    my $warnings = 0;
+    no warnings 'redefine';
+    local *Catalyst::Log::warn = sub { $warnings++ };
+
+    # try to get nonexisting object w/o regexp fallback
+    is( MyApp::WithoutRegexFallback->controller('Foo'), undef, 'no controller Foo found');
+    ok( !$warnings, 'no regexp fallback warnings' );
+}

Modified: Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_load_catalyst_test.t
===================================================================
--- Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_load_catalyst_test.t	2009-11-12 01:19:45 UTC (rev 11802)
+++ Catalyst-Runtime/5.80/branches/aggregate_more/t/aggregate/unit_load_catalyst_test.t	2009-11-12 01:39:56 UTC (rev 11803)
@@ -4,8 +4,8 @@
 use warnings;
 
 use FindBin;
-use lib         "$FindBin::Bin/lib";
-use Test::More  tests => 59;
+use lib         "$FindBin::Bin/../lib";
+use Test::More  tests => 61;
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 use Catalyst::Utils;
@@ -89,6 +89,9 @@
                                 "               Content recorded in response" );
         ok( $c->stash,          "               Stash accessible" );
         ok( $c->action,         "               Action object accessible" );
+        ok( $res->request,      "               Response has request object" );
+        lives_and { is( $res->request->uri, $Url) }
+                                "               Request object has correct url";
     } }
 }
 




More information about the Catalyst-commits mailing list