X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Fdbixcsl_common_tests.pm;h=d1a66fd7d90f405f7a9529622a2e0901d5569436;hb=7159181985da6d98e89c19336061eb8d72516e19;hp=9e3fb5c6d79020bbf0ad6479c6d8e04066e3fc22;hpb=1031d4f67bc267f2c45914cfca125f4ea59f1ca5;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 9e3fb5c..d1a66fd 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -43,7 +43,7 @@ sub _monikerize { sub run_tests { my $self = shift; - plan tests => 50; + plan tests => 54; $self->create(); @@ -158,6 +158,17 @@ sub run_tests { is( $obj->id, 1 ); is( $obj->dat, "foo" ); is( $rsobj2->count, 4 ); + my $saved_id; + eval { + my $new_obj1 = $rsobj1->create({ dat => 'newthing' }); + $saved_id = $new_obj1->id; + }; + ok(!$@) or diag "Died during create new record using a PK::Auto key: $@"; + ok($saved_id) or diag "Failed to get PK::Auto-generated id"; + + my $new_obj1 = $rsobj1->search({ dat => 'newthing' })->first; + ok($new_obj1) or diag "Cannot find newly inserted PK::Auto record"; + is($new_obj1->id, $saved_id); my ($obj2) = $rsobj2->find( dat => 'bbb' ); is( $obj2->id, 2 );