9 my $schema = DBICTest->init_schema();
11 my $cd = $schema->resultset('CD')->find(2);
12 is($cd->notes, $cd->liner_notes->notes, 'notes proxy ok');
13 is($cd->artist_name, $cd->artist->name, 'artist_name proxy ok');
15 my $track = $cd->tracks->first;
16 is($track->cd_title, $track->cd->title, 'cd_title proxy ok');
17 is($track->cd_title, $cd->title, 'cd_title proxy II ok');
18 is($track->year, $cd->year, 'year proxy ok');
20 my $tag = $schema->resultset('Tag')->first;
21 is($tag->year, $tag->cd->year, 'year proxy II ok');
22 is($tag->cd_title, $tag->cd->title, 'cd_title proxy III ok');
24 my $bookmark = $schema->resultset('Bookmark')->create ({
25 link => { url => 'http://cpan.org', title => 'CPAN' },
27 my $link = $bookmark->link;
28 ok($bookmark->link_id == $link->id, 'link_id proxy ok');
29 is($bookmark->link_url, $link->url, 'link_url proxy ok');
30 is($bookmark->link_title, $link->title, 'link_title proxy ok');
32 my $cd_source_class = $schema->class('CD');
34 $cd_source_class->add_relationship('artist_regex',
35 'DBICTest::Schema::Artist', {
36 'foreign.artistid' => 'self.artist'
37 }, { proxy => qr/\w+/ }
38 ) } qr/unable \s to \s process \s the \s \'proxy\' \s argument/ix,
39 'proxy attr with a regex ok';
41 $cd_source_class->add_relationship('artist_sub',
42 'DBICTest::Schema::Artist', {
43 'foreign.artistid' => 'self.artist'
44 }, { proxy => sub {} }
45 ) } qr/unable \s to \s process \s the \s \'proxy\' \s argument/ix,
46 'proxy attr with a sub ok';