Lose yet another dep (Data::Dumper::Concise)
[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;
8fc4291e 9use DBIx::Class::_Util 'dump_value';
e9bd1473 10
11my $schema = DBICTest->init_schema();
12
f1952f5c 13plan tests => 3;
e9bd1473 14
e9bd1473 15# bug in 0.07000 caused attr (join/prefetch) to be modifed by search
16# so we check the search & attr arrays are not modified
17my $search = { 'artist.name' => 'Caterwauler McCrae' };
18my $attr = { prefetch => [ qw/artist liner_notes/ ],
19 order_by => 'me.cdid' };
8fc4291e 20my $search_str = dump_value $search;
21my $attr_str = dump_value $attr;
e9bd1473 22
23my $rs = $schema->resultset("CD")->search($search, $attr);
24
8fc4291e 25is( dump_value $search, $search_str, 'Search hash untouched after search()');
26is( dump_value $attr, $attr_str, 'Attribute hash untouched after search()');
e9bd1473 27cmp_ok($rs + 0, '==', 3, 'Correct number of records returned');