« Catalyst/TraitFor/Model/DBIC/Schema/FromMigration/_MigrationHelper.pm
↑ Summary
DBIx/Class/Migration/RunScript/Trait/Populate.pm »
| 1 | package Test::DBIx::Class::FixtureCommand::Population; | ||
| 2 | |||
| 3 | use Moo; | ||
| 4 | use DBIx::Class::Migration::Population; | ||
| 5 | |||
| 6 | with 'Test::DBIx::Class::Role::FixtureCommand'; | ||
| 7 | |||
| 8 | sub install_fixtures { | ||
| 9 | my ($self, $sets, @rest) = @_; | ||
| 10 | my @sets = ref($sets) ? @$sets : ($sets, @rest); | ||
| 11 | my $schema = $self | ||
| 12 | ->schema_manager | ||
| 13 | ->schema; | ||
| 14 | |||
| 15 | DBIx::Class::Migration::Population | ||
| 16 | ->new(schema=>$schema) | ||
| 17 | ->populate(@sets); | ||
| 18 | } | ||
| 19 | |||
| 20 | __PACKAGE__->meta->make_immutable; | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | Test::DBIx::Class::FixtureCommand::Population - Use your fixtures in a test case. | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | use Test::Most; | ||
| 29 | use Test::DBIx::Class | ||
| 30 | -schema_class=>'MusicBase::Schema', | ||
| 31 | -fixture_class => '::Population, | ||
| 32 | qw(Artist); | ||
| 33 | |||
| 34 | fixtures_ok ['all_tables']; | ||
| 35 | fixtures_ok ['more_sets', 'and_even_more_sets']; | ||
| 36 | |||
| 37 | ## You test cases ## | ||
| 38 | |||
| 39 | done_testing; | ||
| 40 | |||
| 41 | =head1 DESCRIPTION | ||
| 42 | |||
| 43 | Integration between L<DBIx::Class::Migration::Population> and | ||
| 44 | L<Test::DBIx::Class>. Does the L<Test::DBIx::Class::Role::FixtureCommand> | ||
| 45 | Role. | ||
| 46 | |||
| 47 | Allows you to pass an arrayref of fixture set names to C<fixtures_ok>. | ||
| 48 | |||
| 49 | =head1 SEE ALSO | ||
| 50 | |||
| 51 | L<DBIx::Class::Migration::Population>, L<Test::DBIx::Class> | ||
| 52 | |||
| 53 | =head1 AUTHOR | ||
| 54 | |||
| 55 | See L<DBIx::Class::Migration> for author information | ||
| 56 | |||
| 57 | =head1 COPYRIGHT & LICENSE | ||
| 58 | |||
| 59 | See L<DBIx::Class::Migration> for copyright and license information | ||
| 60 | |||
| 61 | =cut |