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