new test case with nested resultsources
[dbsrgits/DBIx-Class-Fixtures.git] / t / 19-complex-hierarchy.t
CommitLineData
c7aececc 1#!perl
2
3use DBIx::Class::Fixtures;
98692f58 4use Test::More tests => 7;
c7aececc 5use lib qw(t/lib);
6use DBICTest;
7use Path::Class;
8use Data::Dumper;
9use IO::All;
10
11use if $^O eq 'MSWin32','Devel::Confess';
12# set up and populate schema
13ok(my $schema = DBICTest->init_schema(), 'got schema');
14
15my $config_dir = io->catfile(qw't var configs')->name;
16
17# Add washedup
18
19ok my $artist = $schema->resultset("Artist")->find(1);
20ok my $washed_up = $artist->create_related('washed_up', +{});
21ok $washed_up->fk_artistid;
22
c7aececc 23
98692f58 24ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir');
25ok($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 42ok(
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