Use source->name or source->source_name for naming of sources in a central method
[dbsrgits/DBIx-Class-Fixtures.git] / t / 09-dump-scalar-ref.t
CommitLineData
c40935c5 1#!perl
2
3use DBIx::Class::Fixtures;
4use Test::More tests => 7;
5use lib qw(t/lib);
6use DBICTest;
7use Path::Class;
8use Data::Dumper;
9
10# set up and populate schema
11ok(my $schema = DBICTest->init_schema(), 'got schema');
12
13my $config_dir = 't/var/configs';
14
15# do dump
16ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir');
17
18ok($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
dcdf675f 34 my $dir = dir('t/var/fixtures/CD');
c40935c5 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