1 use DBIx::Class::Fixtures;
2 use Test::More tests => 9;
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 my $ret = $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);
25 ok -e 't/var/fixtures/multi/date.json/artist',
26 'artist directory created';
28 my $dir = dir('t/var/fixtures/multi/date.json/artist');
29 my @children = $dir->children;
30 is(scalar(@children), 1, 'right number of fixtures created');
32 my $fix_file = $children[0];
33 my $HASH1; eval($fix_file->slurp());
34 is(ref $HASH1, 'HASH', 'fixture evals into hash');
36 is_deeply([sort $schema->source('Artist')->columns], [sort keys %{$HASH1}], 'fixture has correct keys');
38 my $artist = $schema->resultset('Artist')->find($HASH1->{artistid});
39 is_deeply({$artist->get_columns}, $HASH1, 'dumped fixture is equivalent to artist row');
41 $schema->resultset('Artist')->delete; # so we can create the row again on the next line
42 ok($schema->resultset('Artist')->create($HASH1), 'new dbic row created from fixture');