Commit | Line | Data |
f81264b2 |
1 | #!perl |
2 | |
3 | use DBIx::Class::Fixtures; |
4 | use Test::More tests => 5; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | use Path::Class; |
8 | use Data::Dumper; |
66d02e24 |
9 | use IO::All; |
f81264b2 |
10 | |
11 | # set up and populate schema |
12 | ok(my $schema = DBICTest->init_schema(), 'got schema'); |
66d02e24 |
13 | my $config_dir = io->catfile(qw't var configs')->name; |
f81264b2 |
14 | |
15 | # do dump |
8a1df391 |
16 | ok(my $fixtures = DBIx::Class::Fixtures->new({ |
17 | config_dir => $config_dir, |
18 | debug => 0 }), |
19 | 'object created with correct config dir'); |
f81264b2 |
20 | |
8a1df391 |
21 | ok($fixtures->dump({ |
22 | config => "simple.json", |
23 | schema => $schema, |
66d02e24 |
24 | directory => io->catfile(qw't var fixtures' )->name |
8a1df391 |
25 | }), |
26 | "simple dump executed okay"); |
27 | |
28 | $fixtures->populate({ |
66d02e24 |
29 | ddl => io->catfile(qw't lib sqlite.sql')->name, |
30 | connection_details => ['dbi:SQLite:'.io->catfile(qw't var DBIxClass.db')->name, '', ''], |
31 | directory => io->catfile(qw't var fixtures')->name, |
32 | post_ddl => io->catfile(qw't lib post_sqlite.sql')->name |
8a1df391 |
33 | }); |
f81264b2 |
34 | |
8a1df391 |
35 | $schema = DBICTest->init_schema(no_deploy => 1); |
36 | |
37 | my $producer = $schema->resultset('Producer')->find(999999); |
f81264b2 |
38 | isa_ok($producer, "DBICTest::Producer", "Got post-ddl producer"); |
8a1df391 |
39 | is($producer->name, "PostDDL", "Got producer name"); |
f81264b2 |
40 | |