Fix unique constraint violations in Ordered.pm blanket movement (RT#79773)
[dbsrgits/DBIx-Class.git] / t / ordered / unordered_movement.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 my $cd = $schema->resultset('CD')->next;
12
13 lives_ok {
14   $cd->tracks->delete;
15
16   my @tracks = map
17     { $cd->create_related('tracks', { title => "t_$_", position => $_ }) }
18     (4,2,5,1,3)
19   ;
20
21   for (@tracks) {
22     $_->discard_changes;
23     $_->delete;
24   }
25 } 'Creation/deletion of out-of order tracks successful';
26
27 done_testing;