[Dbix-class] cascade delete problem
Richard Jolly
richardjolly at mac.com
Fri Mar 31 08:16:15 CEST 2006
On 30 Mar 2006, at 12:14, Richard Jolly wrote:
> I have a simple cascade delete test that fails under 6.0 but passed
> under 5.007.
I've written this as a failing test against trunk. I'd expect its
something I've misunderstood rather than a real bug, but here it is
anyway. Inline as a patch, and two files attached in case I've got the
patch wrong.
Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 26cascade_delete.t
Type: application/octet-stream
Size: 141 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060331/87204c7e/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 26cascade_delete.tl
Type: application/octet-stream
Size: 307 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060331/87204c7e/attachment-0001.obj
-------------- next part --------------
==== Patch <cascade_delete> level 1
Source: [No source]
Target: 58e6d779-1806-0410-870b-b3f1ff428cff:/local/dbix-class/t:7330
[local]
Log:
cascade_delete test
=== basicrels/26cascade_delete.t
==================================================================
--- basicrels/26cascade_delete.t (revision 7330)
+++ basicrels/26cascade_delete.t (patch cascade_delete level 1)
@@ -0,0 +1,7 @@
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+use DBICTest::BasicRels;
+
+require "t/run/26cascade_delete.tl";
+run_tests(DBICTest->schema);
=== run/26cascade_delete.tl
==================================================================
--- run/26cascade_delete.tl (revision 7330)
+++ run/26cascade_delete.tl (patch cascade_delete level 1)
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+sub run_tests {
+my $schema = shift;
+
+plan tests => 2;
+my $artist = $schema->resultset('Artist')->find(1);
+
+$artist->delete;
+is( $schema->resultset('Artist')->count, 0, 'artist deleted');
+is( $schema->resultset('CD')->search({artist => 1})->count, 0,
'related cds deleted');
+
+}
+1;
More information about the Dbix-class
mailing list