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