changelog, and releasing as stable
[dbsrgits/DBIx-Class-Fixtures.git] / t / 19-complex-hierarchy.t
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 use IO::All;
10
11 use if $^O eq 'MSWin32','Devel::Confess';
12 # set up and populate schema
13 ok(my $schema = DBICTest->init_schema(), 'got schema');
14
15 my $config_dir = io->catfile(qw't var configs')->name;
16
17 # Add washedup
18
19 ok my $artist = $schema->resultset("Artist")->find(1);
20 ok my $washed_up = $artist->create_related('washed_up', +{});
21 ok $washed_up->fk_artistid;
22
23
24 ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir');
25 ok($fixtures->dump({
26         config => {
27             "might_have" => {
28                 "fetch" => 0
29             },
30             "has_many" => {
31                 "fetch" => 0
32             },
33             "sets" => [{
34                 "class" => "Artist::WashedUp",
35                 "quantity" => 1
36             }]
37         },
38         schema => $schema, 
39         directory => io->catfile(qw't var fixtures')->name,
40     }), 'simple dump executed okay');
41
42 ok(
43   $fixtures->dump({
44     config => 'washed-up.json',
45     schema => $schema, 
46     directory => io->catfile(qw't var fixtures')->name,
47   }));
48
49