53825b811fa3318c4102dd44e965c7d651f08d14
[dbsrgits/DBIx-Class.git] / t / 96multi_create / cd_single.t
1 use strict;
2 use warnings;
3
4 use Test::More qw(no_plan);
5 use Test::Exception;
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 eval {
12   my $cd = $schema->resultset('CD')->first;
13   my $track = $schema->resultset('Track')->new_result({
14     cd => $cd,
15     position => 77,  # some day me might test this with Ordered
16     title => 'Multicreate rocks',
17     cd_single => {
18       artist => $cd->artist,
19       year => 2008,
20       title => 'Disemboweling MultiCreate',
21     },
22   });
23
24   isa_ok ($track, 'DBICTest::Track', 'Main Track object created');
25
26   $track->insert;
27
28   ok(1, 'created track');
29
30   is($track->title, 'Multicreate rocks', 'Correct Track title');
31
32   my $single = $track->cd_single;
33
34   ok($single->cdid, 'Got cdid');
35 };