Commit | Line | Data |
c7aececc |
1 | #!perl |
2 | |
3 | use DBIx::Class::Fixtures; |
98692f58 |
4 | use Test::More tests => 7; |
c7aececc |
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 | |
c7aececc |
23 | |
98692f58 |
24 | ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); |
25 | ok($fixtures->dump({ |
c7aececc |
26 | config => { |
27 | "might_have" => { |
28 | "fetch" => 0 |
29 | }, |
30 | "has_many" => { |
31 | "fetch" => 0 |
32 | }, |
33 | "sets" => [{ |
98692f58 |
34 | "class" => "Artist::WashedUp", |
c7aececc |
35 | "quantity" => 1 |
36 | }] |
37 | }, |
38 | schema => $schema, |
39 | directory => io->catfile(qw't var fixtures')->name, |
40 | }), 'simple dump executed okay'); |
41 | |
98692f58 |
42 | ok( |
43 | $fixtures->dump({ |
44 | config => 'washed-up.json', |
45 | schema => $schema, |
46 | directory => io->catfile(qw't var fixtures')->name, |
47 | })); |
c7aececc |
48 | |
c7aececc |
49 | |