X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F80unique.t;h=0e4108bf0cd7952c216858654acd413a9597a720;hb=e81f0fe2065fb6b30eb27accf7bbf372103e0a26;hp=8bd7e2cd0189a74a6463b0fec2740cb6ea63b77a;hpb=9ffa8fd71f7e3e8c81b785f2e49353af93c13aa9;p=dbsrgits%2FDBIx-Class.git diff --git a/t/80unique.t b/t/80unique.t index 8bd7e2c..0e4108b 100644 --- a/t/80unique.t +++ b/t/80unique.t @@ -1,14 +1,14 @@ use strict; -use warnings; +use warnings; use Test::More; use lib qw(t/lib); use DBICTest; +use DBIC::SqlMakerTest; +use DBIC::DebugObj; my $schema = DBICTest->init_schema(); -plan tests => 49; - # Check the defined unique constraints is_deeply( [ sort $schema->source('CD')->unique_constraint_names ], @@ -195,7 +195,7 @@ is($row->baz, 3, 'baz is correct'); { key => 'cd_artist_title' } ); - ok(!$cd1->in_storage, 'CD is not in storage yet after update_or_new'); + is($cd1->in_storage, 0, 'CD is not in storage yet after update_or_new'); $cd1->insert; ok($cd1->in_storage, 'CD got added to strage after update_or_new && insert'); @@ -209,4 +209,27 @@ is($row->baz, 3, 'baz is correct'); ); ok($cd2->in_storage, 'Updating year using update_or_new was successful'); is($cd2->id, $cd1->id, 'Got the same CD using update_or_new'); -} \ No newline at end of file +} + +# make sure the ident condition is assembled sanely +{ + my $artist = $schema->resultset('Artist')->next; + + my ($sql, @bind); + $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind)), + $schema->storage->debug(1); + + $artist->discard_changes; + + is_same_sql_bind ( + $sql, + \@bind, + 'SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE me.artistid = ?', + [qw/'1'/], + ); + + $schema->storage->debug(0); + $schema->storage->debugobj(undef); +} + +done_testing;