X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F80unique.t;h=eebb66eb05bd7271ee68440f930b4d9a2d939cf3;hb=6095cb703bcad95a735dcc2a557371fe9060d32e;hp=9c03fc448cad6854e977821f4c529aea39225a24;hpb=dcfb635f476fcc455f008fc68c8a8d106d32a22f;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/80unique.t b/t/80unique.t index 9c03fc4..eebb66e 100644 --- a/t/80unique.t +++ b/t/80unique.t @@ -7,7 +7,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 39; +plan tests => 43; # Check the defined unique constraints is_deeply( @@ -151,3 +151,17 @@ my $track = $schema->resultset('Track')->find( is($track->get_column('cd'), 1, 'track cd is correct'); is($track->get_column('position'), 3, 'track position is correct'); + +# Test a table with a unique constraint but no primary key +my $row = $schema->resultset('NoPrimaryKey')->update_or_create( + { + foo => 1, + bar => 2, + baz => 3, + }, + { key => 'foo_bar' } +); +ok(! $row->is_changed, 'update_or_create on table without primary key: row is clean'); +is($row->foo, 1, 'foo is correct'); +is($row->bar, 2, 'bar is correct'); +is($row->baz, 3, 'baz is correct');