Commit | Line | Data |
c40935c5 |
1 | #!perl |
2 | |
3 | use DBIx::Class::Fixtures; |
4 | use Test::More tests => 7; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | use Path::Class; |
8 | use Data::Dumper; |
9 | |
10 | # set up and populate schema |
11 | ok(my $schema = DBICTest->init_schema(), 'got schema'); |
12 | |
13 | my $config_dir = 't/var/configs'; |
14 | |
15 | # do dump |
16 | ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); |
17 | |
18 | ok($fixtures->dump({ config => 'scalar_ref.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay'); |
19 | |
20 | { |
21 | # check dump is okay |
22 | my $dir = dir('t/var/fixtures/artist'); |
23 | my @children = $dir->children; |
24 | is(scalar(@children), 1, 'right number of fixtures created'); |
25 | |
26 | my $fix_file = $children[0]; |
27 | my $HASH1; eval($fix_file->slurp()); |
28 | |
29 | is($HASH1->{name}, 'We Are Goth', 'correct artist dumped'); |
30 | } |
31 | |
32 | { |
33 | # check dump is okay |
34 | my $dir = dir('t/var/fixtures/cd'); |
35 | my @children = $dir->children; |
36 | is(scalar(@children), 1, 'right number of fixtures created'); |
37 | |
38 | my $fix_file = $children[0]; |
39 | my $HASH1; eval($fix_file->slurp()); |
40 | |
41 | is($HASH1->{title}, 'Come Be Depressed With Us', 'correct cd dumped'); |
42 | } |
43 | |
44 | |