[Catalyst-commits] r11257 - in
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t:
aggregate lib lib/TestAppSearchExtra
lib/TestAppSearchExtra/Controller
lib/TestAppSearchExtra/Model lib/TestAppSearchExtraX
lib/TestAppSearchExtraX/Controller lib/TestAppSearchExtraX/Model
rodrigolive at dev.catalyst.perl.org
rodrigolive at dev.catalyst.perl.org
Thu Aug 27 13:35:12 GMT 2009
Author: rodrigolive
Date: 2009-08-27 13:35:11 +0000 (Thu, 27 Aug 2009)
New Revision: 11257
Added:
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/aggregate/live_component_registration-search_extra.t
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra.pm
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Controller/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Controller/Root.pm
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Model/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Model/Foo.pm
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/View/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Controller/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Controller/Baz.pm
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Model/
Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Model/FooBar.pm
Log:
Tests for search_extra components consistency and regression.
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/aggregate/live_component_registration-search_extra.t
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/aggregate/live_component_registration-search_extra.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/aggregate/live_component_registration-search_extra.t 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,41 @@
+#!perl
+# This is a test for apps configured to search extra paths outside
+# of the MyApp namespace:
+#
+# __PACKAGE__->config( setup_components => { search_extra => [ 'TestAppSearchExtraX' ] } );
+#
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More;
+
+plan tests => 8;
+
+use_ok('TestAppSearchExtra');
+
+# this is the regular behaviour for regular models, and always worked:
+ok( defined TestAppSearchExtra->model('Foo'), 'Foo is a regular model - always works' );
+ok( grep( /^Foo/, TestAppSearchExtra->models ), 'Foo is in the models list - always works' );
+
+# now the "search_extra" components...
+
+ok( defined TestAppSearchExtra->component('FooBar'), 'The "search_extra" model FooBaz is a component ok - should work' );
+
+# this is the greatest regression and impacts the most:
+ok( defined TestAppSearchExtra->model('FooBar'), 'FooBar is a "search_extra" model - 5.71 regression' );
+
+# the following doesnt work either on 5.7x nor 5.8, but should...
+
+# on the model side:
+ok( grep( /^FooBar/, TestAppSearchExtra->models ), 'FooBar is in the models list - should work for consistency' );
+
+# on the controller side:
+ok( defined TestAppSearchExtra->component('Baz'),
+ 'The "search_extra" controller Baz is a component - should work' );
+ok( grep( /^Baz/, TestAppSearchExtra->controllers ),
+ 'The "search_extra" Baz is in the controllers list - should work for consistency' );
+
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Controller/Root.pm 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,61 @@
+package TestAppSearchExtra::Controller::Root;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config->{namespace} = '';
+
+=head1 NAME
+
+TestAppSearchExtra::Controller::Root - Root Controller for TestAppSearchExtra
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 index
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $c->response->body( $c->welcome_message );
+}
+
+sub default :Path {
+ my ( $self, $c ) = @_;
+ $c->response->body( 'Page not found' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+=head1 AUTHOR
+
+Catalyst developer
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Model/Foo.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Model/Foo.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra/Model/Foo.pm 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,7 @@
+package TestAppSearchExtra::Model::Foo;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Model';
+
+1;
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtra.pm 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,64 @@
+package TestAppSearchExtra;
+
+use strict;
+use warnings;
+
+use Catalyst::Runtime 5.70;
+
+# Set flags and add plugins for the application
+#
+# -Debug: activates the debug mode for very useful log messages
+# ConfigLoader: will load the configuration from a Config::General file in the
+# application's home directory
+# Static::Simple: will serve static files from the application's root
+# directory
+
+use parent qw/Catalyst/;
+use Catalyst qw/-Debug
+ Static::Simple/;
+our $VERSION = '0.01';
+
+# Configure the application.
+#
+# Note that settings in testappsearchextra.conf (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with an external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config( name => 'TestAppSearchExtra' );
+
+__PACKAGE__->config( setup_components => { search_extra => [ 'TestAppSearchExtraX' ] } );
+
+# Start the application
+__PACKAGE__->setup();
+
+=head1 NAME
+
+TestAppSearchExtra - Catalyst based application
+
+=head1 SYNOPSIS
+
+ script/testappsearchextra_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<TestAppSearchExtra::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Catalyst developer
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Controller/Baz.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Controller/Baz.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Controller/Baz.pm 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,11 @@
+package TestAppSearchExtraX::Controller::Baz;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+sub hello : Local {
+ my ($self,$c)=@_;
+ $c->response->body('Hello from Baz');
+}
+1;
Added: Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Model/FooBar.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Model/FooBar.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/component_registration-search_extra/t/lib/TestAppSearchExtraX/Model/FooBar.pm 2009-08-27 13:35:11 UTC (rev 11257)
@@ -0,0 +1,7 @@
+package TestAppSearchExtraX::Model::FooBar;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Model';
+
+1;
More information about the Catalyst-commits
mailing list