Commit | Line | Data |
aa9f3cc7 |
1 | #!perl |
2 | |
3 | use DBIx::Class::Fixtures; |
4 | use Test::More tests => 7; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | use Path::Class; |
8 | use Data::Dumper; |
9 | use DBICTest::Schema2; |
10 | |
11 | # set up and populate normal schema |
12 | ok(my $schema = DBICTest->init_schema(), 'got schema'); |
13 | my $config_dir = 't/var/configs'; |
14 | |
15 | my @different_connection_details = ('dbi:SQLite:t/var/DBIxClassDifferent.db', '', ''); |
16 | ok(my $schema2 = DBICTest::Schema2->compose_namespace('DBICTest2')->connect(@different_connection_details)); |
17 | unlink('t/var/DBIxClassDifferent.db') if (-e 't/var/DBIxClassDifferent.db'); |
18 | DBICTest->deploy_schema($schema2, 't/lib/sqlite_different.sql'); |
19 | # do dump |
20 | ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); |
21 | ok($fixtures->dump({ config => "simple.json", schema => $schema, directory => 't/var/fixtures' }), "simple dump executed okay"); |
22 | |
23 | ok($fixtures->populate({ ddl => 't/lib/sqlite_different.sql', connection_details => [@different_connection_details], directory => 't/var/fixtures' }), 'mysql populate okay'); |
24 | ok($fixtures->populate({ ddl => 't/lib/sqlite.sql', connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], directory => 't/var/fixtures' }), 'sqlite populate okay'); |
25 | |
26 | is($schema->resultset('Artist')->count, 1, 'artist imported to sqlite okay'); |