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