(travis) Work around RT#116788
[dbsrgits/DBIx-Class.git] / t / ordered / unordered_movement.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
375c84bb 3use strict;
4use warnings;
5
6use Test::More;
7use Test::Exception;
c0329273 8
375c84bb 9use DBICTest;
10
11my $schema = DBICTest->init_schema();
12
13my $cd = $schema->resultset('CD')->next;
37b9b05b 14$cd->tracks->delete;
375c84bb 15
37b9b05b 16$schema->resultset('CD')->related_resultset('tracks')->delete;
375c84bb 17
37b9b05b 18is $cd->tracks->count, 0, 'No tracks';
375c84bb 19
37b9b05b 20$cd->create_related('tracks', { title => "t_$_", position => $_ })
21 for (4,2,3,1,5);
22
23is $cd->tracks->count, 5, 'Created 5 tracks';
24
25# a txn should force the implicit pos reload, regardless of order
26$schema->txn_do(sub {
27 $cd->tracks->delete_all
28});
29
30is $cd->tracks->count, 0, 'Successfully deleted everything';
375c84bb 31
32done_testing;