From: Tomas Doran Date: Fri, 5 Dec 2008 00:55:26 +0000 (+0000) Subject: Remove use of NEXT from the test suite, except for one (commented) case to test back... X-Git-Tag: 5.8000_04~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=dbb2d5cd1b69209e53eb204e7451d688327b2e11 Remove use of NEXT from the test suite, except for one (commented) case to test back compat --- diff --git a/Changes b/Changes index 51c2089..c86f86e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ # This file documents the revision history for Perl extension Catalyst. 5.8000_04 + - Remove use of NEXT from the test suite, except for one case + which tests if Class::C3::Adopt::NEXT is working (t0m) - Use a predicate to avoid recursion in cases where the uri method is overridden by a plugin, and calls the base method, for example Catalyst::Plugin::SmartURI (t0m) diff --git a/Makefile.PL b/Makefile.PL index 7dee547..3973a5b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -33,7 +33,6 @@ requires 'URI' => '1.35'; requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness requires 'MRO::Compat'; -test_requires 'NEXT'; test_requires 'Class::Data::Inheritable'; if ( ( exists $ENV{AGGREGATE_TESTS} && !$ENV{AGGREGATE_TESTS}) diff --git a/t/lib/Catalyst/Action/TestAfter.pm b/t/lib/Catalyst/Action/TestAfter.pm index 61fb9d7..199ea25 100644 --- a/t/lib/Catalyst/Action/TestAfter.pm +++ b/t/lib/Catalyst/Action/TestAfter.pm @@ -8,7 +8,7 @@ use base qw/Catalyst::Action/; sub execute { my $self = shift; my ( $controller, $c ) = @_; - $self->NEXT::execute( @_ ); + $self->next::method( @_ ); $c->res->header( 'X-Action-After', $c->stash->{after_message} ); } diff --git a/t/lib/Catalyst/Action/TestBefore.pm b/t/lib/Catalyst/Action/TestBefore.pm index 8bc2e64..456a990 100644 --- a/t/lib/Catalyst/Action/TestBefore.pm +++ b/t/lib/Catalyst/Action/TestBefore.pm @@ -9,7 +9,7 @@ sub execute { my $self = shift; my ( $controller, $c ) = @_; $c->stash->{test} = 'works'; - $self->NEXT::execute( @_ ); + $self->next::method( @_ ); } 1; diff --git a/t/lib/Catalyst/Plugin/Test/Errors.pm b/t/lib/Catalyst/Plugin/Test/Errors.pm index b040b1c..8876a4d 100644 --- a/t/lib/Catalyst/Plugin/Test/Errors.pm +++ b/t/lib/Catalyst/Plugin/Test/Errors.pm @@ -1,13 +1,13 @@ package Catalyst::Plugin::Test::Errors; use strict; -use NEXT; +use Class::C3; sub error { my $c = shift; unless ( $_[0] ) { - return $c->NEXT::error(@_); + return $c->next::method(@_); } if ( $_[0] =~ /^(Unknown resource|No default action defined)/ ) { @@ -27,7 +27,7 @@ sub error { $c->response->headers->push_header( 'X-Catalyst-Error' => $error ); - $c->NEXT::error(@_); + $c->next::method(@_); } 1; diff --git a/t/lib/Catalyst/Plugin/Test/Headers.pm b/t/lib/Catalyst/Plugin/Test/Headers.pm index 0258a09..3d01b55 100644 --- a/t/lib/Catalyst/Plugin/Test/Headers.pm +++ b/t/lib/Catalyst/Plugin/Test/Headers.pm @@ -1,12 +1,12 @@ package Catalyst::Plugin::Test::Headers; use strict; -use NEXT; +use Class::C3; sub prepare { my $class = shift; - my $c = $class->NEXT::prepare(@_); + my $c = $class->next::method(@_); $c->response->header( 'X-Catalyst-Engine' => $c->engine ); $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 ); @@ -27,7 +27,7 @@ sub prepare { sub prepare_action { my $c = shift; - $c->NEXT::prepare_action(@_); + $c->next::method(@_); $c->res->header( 'X-Catalyst-Action' => $c->req->action ); } diff --git a/t/lib/Catalyst/Plugin/Test/Plugin.pm b/t/lib/Catalyst/Plugin/Test/Plugin.pm index cc6178d..2f6c289 100644 --- a/t/lib/Catalyst/Plugin/Test/Plugin.pm +++ b/t/lib/Catalyst/Plugin/Test/Plugin.pm @@ -1,7 +1,6 @@ package Catalyst::Plugin::Test::Plugin; use strict; -use NEXT; use base qw/Catalyst::Base Class::Data::Inheritable/; @@ -16,6 +15,9 @@ sub prepare { my $class = shift; +# Note: This use of NEXT is deliberately left here to ensure back +# compat, as NEXT always used to be loaded, but is now replaced +# by Class::C3::Adopt::NEXT. my $c = $class->NEXT::prepare(@_); $c->response->header( 'X-Catalyst-Plugin-Setup' => $c->ran_setup ); diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index 23df6ef..d65f6cb 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -61,7 +61,7 @@ sub execute { sub finalize_error { my $c = shift; - $c->NEXT::finalize_error(@_); + $c->next::method(@_); $c->res->status(500); $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) ); diff --git a/t/lib/TestApp/Action/TestBefore.pm b/t/lib/TestApp/Action/TestBefore.pm index 0d802bf..c0db6fe 100644 --- a/t/lib/TestApp/Action/TestBefore.pm +++ b/t/lib/TestApp/Action/TestBefore.pm @@ -9,7 +9,7 @@ sub execute { my $self = shift; my ( $controller, $c, $test ) = @_; $c->res->header( 'X-TestAppActionTestBefore', $test ); - $self->NEXT::execute( @_ ); + $self->next::method( @_ ); } 1; diff --git a/t/lib/TestApp/Action/TestMyAction.pm b/t/lib/TestApp/Action/TestMyAction.pm index 66bcdf9..5a83aee 100644 --- a/t/lib/TestApp/Action/TestMyAction.pm +++ b/t/lib/TestApp/Action/TestMyAction.pm @@ -9,7 +9,7 @@ sub execute { my $self = shift; my ( $controller, $c, $test ) = @_; $c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' ); - $self->NEXT::execute(@_); + $self->next::method(@_); } 1; diff --git a/t/unit_core_component_loading.t b/t/unit_core_component_loading.t index 2587385..6b9f8da 100644 --- a/t/unit_core_component_loading.t +++ b/t/unit_core_component_loading.t @@ -63,10 +63,10 @@ sub make_component_file { write_component_file(\@dir_list, $name_final, <NEXT::COMPONENT(\@_); + my \$self = shift->next::method(\@_); no strict 'refs'; *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; }; \$self; @@ -166,7 +166,7 @@ package ${appclass}::Model::TopLevel; use base 'Catalyst::Model'; sub COMPONENT { - my \$self = shift->NEXT::COMPONENT(\@_); + my \$self = shift->next::method(\@_); no strict 'refs'; *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; }; \$self; @@ -185,7 +185,7 @@ package ${appclass}::Model::TopLevel::Nested; use base 'Catalyst::Model'; no warnings 'redefine'; -sub COMPONENT { return shift->NEXT::COMPONENT(\@_); } +sub COMPONENT { return shift->next::method(\@_); } 1; EOF