1 use DBIx::Class::Fixtures;
2 use Test::More tests => 17;
10 ok my $config_dir = 't/var/configs';
11 ok my $schema = DBICTest->init_schema(), 'got schema';
12 ok my $fixtures = DBIx::Class::Fixtures->new({config_dir => $config_dir}),
13 'object created with correct config dir';
16 $fixtures->dump_config_sets({
17 configs => [qw/date.json rules.json/],
19 directory_template => sub {
20 my ($fixture, $params, $set) = @_;
21 File::Spec->catdir('t','var','fixtures','multi', $set);
24 'simple dump executed okay',
30 my $dir = dir('t/var/fixtures/artist');
31 ok(-e 't/var/fixtures/artist', 'artist directory created');
33 my @children = $dir->children;
34 is(scalar(@children), 1, 'right number of fixtures created');
36 my $fix_file = $children[0];
37 my $HASH1; eval($fix_file->slurp());
38 is(ref $HASH1, 'HASH', 'fixture evals into hash');
40 is_deeply([sort $schema->source('Artist')->columns], [sort keys %{$HASH1}], 'fixture has correct keys');
42 my $artist = $schema->resultset('Artist')->find($HASH1->{artistid});
43 is_deeply({$artist->get_columns}, $HASH1, 'dumped fixture is equivalent to artist row');
45 $schema->resultset('Artist')->delete; # so we can create the row again on the next line
46 ok($schema->resultset('Artist')->create($HASH1), 'new dbic row created from fixture');