X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FCatalyst%2FAction%2FREST%2FController%2FActions.pm;fp=t%2Flib%2FTest%2FCatalyst%2FAction%2FREST%2FController%2FActions.pm;h=f1b6f23d0a954d1e3092265b3ce1df97565acb8d;hb=7656dd125be1895119fad6495083c29599deac44;hp=0000000000000000000000000000000000000000;hpb=5a173b14f2cd6d15a943d36e95f28a4b5280ac00;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm new file mode 100644 index 0000000..f1b6f23 --- /dev/null +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm @@ -0,0 +1,95 @@ +package Test::Catalyst::Action::REST::Controller::Actions; +use strict; +use warnings; + +use base qw/Catalyst::Controller::REST/; + +__PACKAGE__->config( namespace => 'actions' ); + +sub begin {} # Don't need serialization.. + +sub test : Local : ActionClass('REST') { + my ( $self, $c ) = @_; + $c->stash->{'entity'} = 'something'; +} + +sub test_GET :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " GET"; + $c->forward('ok'); +} + +sub test_POST :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " POST"; + $c->forward('ok'); +} + +sub test_PUT :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " PUT"; + $c->forward('ok'); +} + +sub test_DELETE :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + $c->stash->{'entity'} .= " DELETE"; + $c->forward('ok'); +} + +sub test_OPTIONS :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " OPTIONS"; + $c->forward('ok'); +} + +sub notreally : Local : ActionClass('REST') { +} + +sub notreally_GET :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} = "notreally GET"; + $c->forward('ok'); +} + +sub not_implemented : Local : ActionClass('REST') { +} + +sub not_implemented_GET :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} = "not_implemented GET"; + $c->forward('ok'); +} + +sub not_implemented_not_implemented :ActionClass('+Test::Action::Class') { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} = "Not Implemented Handler"; + $c->forward('ok'); +} + +sub not_modified : Local : ActionClass('REST') { } + +sub not_modified_GET { + my ( $self, $c ) = @_; + $c->res->status(304); + return 1; +} + +sub ok : Private { + my ( $self, $c ) = @_; + + $c->res->content_type('text/plain'); + $c->res->body( $c->stash->{'entity'} ); +} + +sub end : Private {} # Don't need serialization.. + +1; +