Commit | Line | Data |
33dd4e80 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | my $schema = DBICTest->init_schema(); |
9 | |
ac8e89d7 |
10 | plan tests => 4; |
33dd4e80 |
11 | |
12 | my $cd2 = $schema->resultset('CD')->create({ artist => |
13 | { name => 'Fred Bloggs' }, |
14 | title => 'Some CD', |
15 | year => 1996 |
16 | }); |
17 | |
ac8e89d7 |
18 | is(ref $cd2->artist, 'DBICTest::Artist', 'Created CD and Artist object'); |
19 | is($cd2->artist->name, 'Fred Bloggs', 'Artist created correctly'); |
20 | |
21 | my $artist = $schema->resultset('Artist')->create({ name => 'Fred 2', |
22 | cds => [ |
23 | { title => 'Music to code by', |
24 | year => 2007, |
25 | }, |
26 | ], |
27 | }); |
28 | is(ref $artist->cds->first, 'DBICTest::CD', 'Created Artist with CDs'); |
29 | is($artist->cds->first->title, 'Music to code by', 'CD created correctly'); |