Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / 19retrieve_on_insert.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
8b9473f5 3use strict;
4use warnings;
5
6use Test::More;
7use Test::Exception;
c0329273 8
8b9473f5 9use DBICTest;
10
11my $schema = DBICTest->init_schema();
12$schema->storage->sql_maker->quote_char('"');
13
14my $rs = $schema->resultset ('Artist');
15
16my $obj;
17lives_ok { $obj = $rs->create ({ name => 'artistA' }) } 'Default insert successful';
18is ($obj->rank, undef, 'Without retrieve_on_insert, check rank');
19
20$rs->result_source->add_columns(
21 '+rank' => { retrieve_on_insert => 1 }
22);
23
24lives_ok { $obj = $rs->create ({ name => 'artistB' }) } 'Default insert successful';
25is ($obj->rank, 13, 'With retrieve_on_insert, check rank');
26
27done_testing;