CatalystX::CRUD::Test::Controller - mock controller class for testing CatalystX::CRUD packages


CatalystX-CRUD documentation  | view source Contained in the CatalystX-CRUD distribution.

Index


NAME

Top

CatalystX::CRUD::Test::Controller - mock controller class for testing CatalystX::CRUD packages

SYNOPSIS

Top

 package MyApp::Controller::Foo;
 use strict;
 use base qw( CatalystX::CRUD::Test::Controller );

 use MyForm;

 __PACKAGE__->config(
    form_class            => 'MyForm',
    form_fields           => [qw( one two three )],
    init_form             => 'init_with_foo',
    init_object           => 'foo_from_form',
    default_template      => 'no/such/file',
    model_name            => 'Foo',
    primary_key           => 'id',
    view_on_single_result => 0,
    page_size             => 50,
    allow_GET_writes      => 0,
 );

 1;

 


DESCRIPTION

Top

CatalystX::CRUD::Test::Controller is a mock controller class for testing CatalystX::CRUD packages. It implements the required Controller methods and overrides others to work with CatalystX::CRUD::Test::Form.

METHODS

Top

form_to_object

The flow of this methods comes more or less verbatim from the RHTMLO controller.

Returns the object from stash() initialized with the form and request params.

form

Returns a new form_class object every time, initialized with form_fields.

end

If the stash() has an 'object' defined, serializes the object with serialize_object() and sticks it in the response body().

If there are any errors, replaces the normal Catalyst debug screen with contents of $c->error.

serialize_object( context, object )

Serializes object for response. Default is just to create hashref of key/value pairs and send through Data::Dump::dump().

AUTHOR

Top

Peter Karman, <perl at peknet.com>

BUGS

Top

Please report any bugs or feature requests to bug-catalystx-crud at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc CatalystX::CRUD

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/CatalystX-CRUD

* CPAN Ratings

http://cpanratings.perl.org/d/CatalystX-CRUD

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-CRUD

* Search CPAN

http://search.cpan.org/dist/CatalystX-CRUD

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


CatalystX-CRUD documentation  | view source Contained in the CatalystX-CRUD distribution.