Adding a test for unicode
[dbsrgits/DBIx-Class-Fixtures.git] / t / 19-populate-unicode.t
1 #!perl
2
3 use DBIx::Class::Fixtures;
4 use Test::More no_plan;
5 use lib qw(t/lib);
6 use DBICTest;
7 use Path::Class;
8 use Data::Dumper;
9 use IO::All;
10 use utf8;
11
12 # set up and populate schema
13 ok( my $schema = DBICTest->init_schema(), 'got schema' );
14 my $config_dir = io->catfile(qw't var configs')->name;
15
16 # do dump
17 ok(
18     my $fixtures = DBIx::Class::Fixtures->new(
19         {
20             config_dir => $config_dir,
21             debug      => 0
22         }
23     ),
24     'object created with correct config dir'
25 );
26
27 DBICTest->clear_schema($schema);
28 DBICTest->populate_schema($schema);
29
30 ok(
31     $fixtures->dump(
32         {
33             schema    => $schema,
34             directory => io->catfile(qw't var fixtures')->name,
35             config    => "unicode.json",
36         }
37     ),
38     "unicode dump executed okay"
39 );
40
41 $fixtures->populate(
42     {
43         connection_details => [ 'dbi:SQLite:' . io->catfile(qw[ t var DBIxClass.db ])->name, '', '' ],
44         directory          => io->catfile(qw't var fixtures')->name,
45         schema             => $schema,
46         no_deploy          => 1,
47         use_find_or_create => 1,
48     }
49 );
50
51 my $cd = $schema->resultset('CD')->find( { cdid => 5 });
52
53 is($cd->title, "Unicode Chars ™ © • † ∑ α β « » → …", "Unicode chars found");