DBIx-Class-EasyFixture
view release on metacpan or search on metacpan
lib/DBIx/Class/EasyFixture/Tutorial.pm view on Meta::CPAN
Managing test data is hard enough without having a clean way of maintaining
fixtures. L<DBIx::Class::EasyFixture> makes it easy to define fixtures.
Different scenarios can be loaded on demand to test different facets of your
system. Fixtures can take a while to write, but once defined, there's less
cutting and pasting of code.
=head1 CREATING YOUR FIXTURE CLASS
To use C<DBIx::Class::EasyFixture>, you must first create a subclass of it.
It's required to define two methods: C<get_fixture> and C<all_fixture_names>.
You may implement those any way you wish and you're not locked into a
particular format. Here's one way to do it, using a big hash (there are plenty
of other ways to do this, but this is easy for a tutorial.
package My::Fixtures;
use Moo; # (Moose is also fine)
extends 'DBIx::Class::EasyFixture';
my %definition_for = (
# keys are fixture names, values are the fixture definitions
);
( run in 0.878 second using v1.01-cache-2.11-cpan-49f99fa48dc )