X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F76joins.t;h=84d8ba5439614fb99f44d8e6bb34c3c04ca11ae6;hb=e73060754e523491074eb997804287ccf9a6f08b;hp=744bfd72007870637069fde09d2776403a0573ee;hpb=9b4591296c196ea0a32e67159e35091b02ecc539;p=dbsrgits%2FDBIx-Class.git diff --git a/t/76joins.t b/t/76joins.t index 744bfd7..84d8ba5 100644 --- a/t/76joins.t +++ b/t/76joins.t @@ -5,7 +5,7 @@ use Test::More; use lib qw(t/lib); use DBICTest; use Data::Dumper; -use SQL::Abstract::Test import => ['is_same_sql_bind']; +use DBIC::SqlMakerTest; my $schema = DBICTest->init_schema(); @@ -17,7 +17,7 @@ BEGIN { eval "use DBD::SQLite"; plan $@ ? ( skip_all => 'needs DBD::SQLite for testing' ) - : ( tests => 16 ); + : ( tests => 18 ); } # figure out if we've got a version of sqlite that is older than 3.2.6, in @@ -179,3 +179,28 @@ cmp_ok( $rs->count, '==', 1, "Single record in resultset"); is($rs->first->name, 'We Are Goth', 'Correct record returned'); +# test for warnings on delete of joined resultset +$rs = $schema->resultset("CD")->search( + { 'artist.name' => 'Caterwauler McCrae' }, + { join => [qw/artist/]} +); +my $tst_delete_warning; +eval { + local $SIG{__WARN__} = sub { $tst_delete_warning = shift }; + $rs->delete(); +}; + +ok( ($@ || $tst_delete_warning), 'fail/warning on attempt to delete a join-ed resultset'); + +# test for warnings on update of joined resultset +$rs = $schema->resultset("CD")->search( + { 'artist.name' => 'Random Boy Band' }, + { join => [qw/artist/]} +); +my $tst_update_warning; +eval { + local $SIG{__WARN__} = sub { $tst_update_warning = shift }; + $rs->update({ 'artist' => 1 }); +}; + +ok( ($@ || $tst_update_warning), 'fail/warning on attempt to update a join-ed resultset');