remove trailing comma
[dbsrgits/DBIx-Class-Fixtures.git] / t / 20-virtual-column.t
CommitLineData
af45f212 1use strict;
2use warnings;
3
19c6539b 4use DBIx::Class::Fixtures;
5use Test::More;
6use Test::Fatal;
7use File::Path 'rmtree';
8
9use lib qw(t/lib/DBICTest);
10use Schema3;
11use Test::TempDir::Tiny;
12use IO::All;
13
14my $tempdir = tempdir;
15
16(my $schema = Schema3->connect(
17 'DBI:SQLite::memory:','',''))->init_schema;
18
19ok my $row = $schema
20 ->resultset('Person')
21 ->first;
22
23ok $row->get_column('weight_to_height_ratio'),
24 'has virtual column';
25
26my $fixtures = DBIx::Class::Fixtures
27 ->new({
28 config_dir => io->catfile(qw't var configs')->name,
29 debug => 0 });
30
31ok(
32 $fixtures->dump({
33 config => 'virtual-columns.json',
34 schema => $schema,
35 directory => io->catfile($tempdir, 'people')->name }),
36 'fetch dump executed okay');
37
38ok $schema->resultset('Person')->delete;
39
40is exception {
41 $fixtures->populate({
42 no_deploy => 1,
43 schema => $schema,
44 directory => io->catfile($tempdir, 'people')->name
45 })
46}, undef, 'populated';
47
48$row = $schema->resultset('Person')->first;
49
50BAIL_OUT("can't continue without data") unless $row;
51
52ok $row->get_column('weight_to_height_ratio'),
53 'still has virtual column';
54
55done_testing;
56
57END {
58 rmtree io->catfile(qw't var files')->name;
59 rmtree io->catfile($tempdir, 'people')->name;
60}