Only normalize conditions during resolution time, instead on every ->search
[dbsrgits/DBIx-Class.git] / t / ordered / unordered_movement.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 use DBICTest;
10
11 my $schema = DBICTest->init_schema();
12
13 my $cd = $schema->resultset('CD')->next;
14 $cd->tracks->delete;
15
16 $schema->resultset('CD')->related_resultset('tracks')->delete;
17
18 is $cd->tracks->count, 0, 'No tracks';
19
20 $cd->create_related('tracks', { title => "t_$_", position => $_ })
21   for (4,2,3,1,5);
22
23 is $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
30 is $cd->tracks->count, 0, 'Successfully deleted everything';
31
32 done_testing;