6 use DBICTest; # do not remove even though it is not used
8 #15:01 <@ribasushi> dhoss: you are complicating your life
9 #15:01 <@ribasushi> dhoss: start from the other side:
10 #15:02 <@ribasushi> if currently you add a test to t/??ordered.t that does
11 # $ordered_rs->search({ condition to not delete
12 # everything})->delete;
13 #15:03 <@ribasushi> dhoss: and then examine the database - you will see
15 #15:03 <@ribasushi> dhoss: use your newly found component injection powers to
16 # change the delete into a delete_all behind the scenes - the
17 # remaining rows will then be reordered correctly
18 #15:03 <@ribasushi> dhoss: this way you both test that injection works AND you
21 my $schema = DBICTest->init_schema();
23 $schema->resultset('Artist')->search( {}, { rows => 1 } )
24 ->single; # braindead sqlite
25 my $cd = $schema->resultset('CD')->create(
28 title => 'Get in order',
30 tracks => [ { title => 'T1' }, { title => 'T2' }, { title => 'T3' }, ],
35 lives_ok( sub { $cd->delete },
36 "Cascade delete on ordered has_many doesn't bomb" );
39 mro::get_linear_isa( ref $schema->resultset("Track") ),
42 DBIx::Class::Ordered::ResultSet
43 DBIx::Class::ResultSet
45 DBIx::Class::Componentised
46 Class::C3::Componentised
47 Class::Accessor::Grouped
50 "MRO for class is correct"