1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
10 my $schema = DBICTest->init_schema();
11 $schema->storage->sql_maker->quote_char('"');
13 my $rs = $schema->resultset ('Artist');
14 my $last_obj = $rs->search ({}, { order_by => { -desc => 'artistid' }, rows => 1})->single;
15 my $last_id = $last_obj ? $last_obj->artistid : 0;
18 $schema->is_executed_sql_bind( sub {
19 $obj = $rs->create ({})
21 'INSERT INTO "artist" DEFAULT VALUES'
22 ]], 'Default-value insert correct SQL' );
24 ok ($obj, 'Insert defaults ( $rs->create ({}) )' );
26 # this should be picked up without calling the DB again
27 is ($obj->artistid, $last_id + 1, 'Autoinc PK works');
29 # for this we need to refresh
30 $obj->discard_changes;
31 is ($obj->rank, 13, 'Default value works');