make dump/populate work with mixed case table names
Will Hawes [Wed, 28 Sep 2011 12:50:39 +0000 (13:50 +0100)]
t/18-dump-mixed-case.t [new file with mode: 0644]
t/lib/DBICTest/Schema/MixedCase.pm [new file with mode: 0644]
t/var/configs/mixed-case.json [new file with mode: 0644]

diff --git a/t/18-dump-mixed-case.t b/t/18-dump-mixed-case.t
new file mode 100644 (file)
index 0000000..5deacbb
--- /dev/null
@@ -0,0 +1,23 @@
+#!perl
+
+use DBIx::Class::Fixtures;
+use Test::More tests => 3;
+use lib qw(t/lib);
+use DBICTest;
+use Path::Class;
+use Data::Dumper; 
+
+# set up and populate schema
+ok(my $schema = DBICTest->init_schema(), 'got schema');
+
+my $config_dir = 't/var/configs';
+
+{
+    # do dump
+    ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir');
+    ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay');
+
+    # check dump is okay
+    my $dir = dir('t/var/fixtures/MixedCase');
+    ok(-e 't/var/fixtures/MixedCase', 'MixedCase directory created');
+}
diff --git a/t/lib/DBICTest/Schema/MixedCase.pm b/t/lib/DBICTest/Schema/MixedCase.pm
new file mode 100644 (file)
index 0000000..9aa1357
--- /dev/null
@@ -0,0 +1,20 @@
+package # hide from PAUSE 
+    DBICTest::Schema::MixedCase;
+
+use base 'DBIx::Class::Core';
+
+__PACKAGE__->table('MixedCase');
+__PACKAGE__->add_columns(
+  'id' => {
+    data_type => 'integer',
+    is_auto_increment => 1,
+  },
+  'name' => {
+    data_type => 'varchar',
+    size      => 100,
+    is_nullable => 1,
+  },
+);
+__PACKAGE__->set_primary_key('id');
+
+1;
diff --git a/t/var/configs/mixed-case.json b/t/var/configs/mixed-case.json
new file mode 100644 (file)
index 0000000..5a49395
--- /dev/null
@@ -0,0 +1,6 @@
+{
+        "sets": [{
+            "class": "MixedCase",
+            "quantity": 1
+        }]
+}