Move tmpdir() to DBICTest::Util where it belongs
[dbsrgits/DBIx-Class.git] / t / prefetch / attrs_untouched.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
8273e845 3use warnings;
4a233f30 4use strict;
e9bd1473 5
6use Test::More;
c0329273 7
e9bd1473 8use DBICTest;
bfa46eb5 9
e9bd1473 10use Data::Dumper;
bfa46eb5 11$Data::Dumper::Sortkeys = 1;
e9bd1473 12
13my $schema = DBICTest->init_schema();
14
f1952f5c 15plan tests => 3;
e9bd1473 16
e9bd1473 17# bug in 0.07000 caused attr (join/prefetch) to be modifed by search
18# so we check the search & attr arrays are not modified
19my $search = { 'artist.name' => 'Caterwauler McCrae' };
20my $attr = { prefetch => [ qw/artist liner_notes/ ],
21 order_by => 'me.cdid' };
22my $search_str = Dumper($search);
23my $attr_str = Dumper($attr);
24
25my $rs = $schema->resultset("CD")->search($search, $attr);
26
27is(Dumper($search), $search_str, 'Search hash untouched after search()');
28is(Dumper($attr), $attr_str, 'Attribute hash untouched after search()');
29cmp_ok($rs + 0, '==', 3, 'Correct number of records returned');