11 my $schema = DBICTest->init_schema();
12 my $rs = $schema->resultset( 'CD' );
17 my $expected = [ 'artist', 'cd' ];
18 my $result = $rs->_merge_attr($a, $b);
19 is_deeply( $result, $expected );
25 my $expected = [ 'artist', 'cd' ];
26 my $result = $rs->_merge_attr($a, $b);
27 is_deeply( $result, $expected );
31 my $a = [ 'artist', 'cd' ];
33 my $expected = [ 'artist', 'cd' ];
34 my $result = $rs->_merge_attr($a, $b);
35 is_deeply( $result, $expected );
39 my $a = [ 'artist', 'artist' ];
40 my $b = [ 'artist', 'cd' ];
41 my $expected = [ 'artist', 'artist', 'cd' ];
42 my $result = $rs->_merge_attr($a, $b);
43 is_deeply( $result, $expected );
47 my $a = [ 'artist', 'cd' ];
48 my $b = [ 'artist', 'artist' ];
49 my $expected = [ 'artist', 'cd', 'artist' ];
50 my $result = $rs->_merge_attr($a, $b);
51 is_deeply( $result, $expected );
55 my $a = [ 'twokeys' ];
56 my $b = [ 'cds', 'cds' ];
57 my $expected = [ 'twokeys', 'cds', 'cds' ];
58 my $result = $rs->_merge_attr($a, $b);
59 is_deeply( $result, $expected );
63 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
65 my $expected = [ 'artist', 'cd', { 'artist' => 'manager' } ];
66 my $result = $rs->_merge_attr($a, $b);
67 is_deeply( $result, $expected );
71 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
72 my $b = [ 'artist', 'cd' ];
73 my $expected = [ 'artist', 'cd', { 'artist' => 'manager' } ];
74 my $result = $rs->_merge_attr($a, $b);
75 is_deeply( $result, $expected );
79 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
80 my $b = { 'artist' => 'manager' };
81 my $expected = [ 'artist', 'cd', { 'artist' => [ 'manager' ] } ];
82 my $result = $rs->_merge_attr($a, $b);
83 is_deeply( $result, $expected );
87 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
88 my $b = { 'artist' => 'agent' };
89 my $expected = [ { 'artist' => 'agent' }, 'cd', { 'artist' => 'manager' } ];
90 my $result = $rs->_merge_attr($a, $b);
91 is_deeply( $result, $expected );
95 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
96 my $b = { 'artist' => { 'manager' => 'artist' } };
97 my $expected = [ 'artist', 'cd', { 'artist' => [ { 'manager' => 'artist' } ] } ];
98 my $result = $rs->_merge_attr($a, $b);
99 is_deeply( $result, $expected );
103 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
104 my $b = { 'artist' => { 'manager' => [ 'artist', 'label' ] } };
105 my $expected = [ 'artist', 'cd', { 'artist' => [ { 'manager' => [ 'artist', 'label' ] } ] } ];
106 my $result = $rs->_merge_attr($a, $b);
107 is_deeply( $result, $expected );
111 my $a = [ 'artist', 'cd', { 'artist' => 'manager' } ];
112 my $b = { 'artist' => { 'tour_manager' => [ 'venue', 'roadie' ] } };
113 my $expected = [ { 'artist' => { 'tour_manager' => [ 'venue', 'roadie' ] } }, 'cd', { 'artist' => 'manager' } ];
114 my $result = $rs->_merge_attr($a, $b);
115 is_deeply( $result, $expected );
119 my $a = [ 'artist', 'cd' ];
120 my $b = { 'artist' => { 'tour_manager' => [ 'venue', 'roadie' ] } };
121 my $expected = [ { 'artist' => { 'tour_manager' => [ 'venue', 'roadie' ] } }, 'cd' ];
122 my $result = $rs->_merge_attr($a, $b);
123 is_deeply( $result, $expected );
127 my $a = [ { 'artist' => 'manager' }, 'cd' ];
128 my $b = [ 'artist', { 'artist' => 'manager' } ];
129 my $expected = [ { 'artist' => 'manager' }, 'cd', { 'artist' => 'manager' } ];
130 my $result = $rs->_merge_attr($a, $b);
131 is_deeply( $result, $expected );