implemented _collapse_result and _merge_result
[dbsrgits/DBIx-Class.git] / t / multi_create / has_many.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 use lib qw(t/lib);
7 use DBICTest;
8
9 plan tests => 2;
10
11 my $schema = DBICTest->init_schema();
12
13 my $track_no_lyrics = $schema->resultset ('Track')
14               ->search ({ 'lyrics.lyric_id' => undef }, { join => 'lyrics' })
15                 ->first;
16
17 my $lyric = $track_no_lyrics->create_related ('lyrics', {
18   lyric_versions => [
19     { text => 'english doubled' },
20     { text => 'english doubled' },
21   ],
22 });
23 is ($lyric->lyric_versions->count, 2, "Two identical has_many's created");
24
25
26 my $link = $schema->resultset ('Link')->create ({
27   url => 'lolcats!',
28   bookmarks => [
29     {},
30     {},
31   ]
32 });
33 is ($link->bookmarks->count, 2, "Two identical default-insert has_many's created");