Commit | Line | Data |
e60dc79f |
1 | use strict; |
5e8cb53c |
2 | use warnings; |
e60dc79f |
3 | |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
7 | |
8 | my $schema = DBICTest->init_schema(); |
9 | |
10 | plan tests => 2; |
11 | |
12 | my $bookmark = $schema->resultset("Bookmark")->find(1); |
13 | my $link = $bookmark->link; |
14 | my $link_id = $link->id; |
15 | |
16 | my $new_link = $schema->resultset("Link")->new({ |
17 | id => 42, |
18 | url => "http://monstersarereal.com", |
19 | title => "monstersarereal.com" |
20 | }); |
21 | |
22 | # Changing a relationship by id rather than by object would cause |
23 | # old related_resultsets to be used. |
24 | $bookmark->link($new_link->id); |
25 | is $bookmark->link->id, $new_link->id; |
26 | |
27 | $bookmark->update; |
28 | is $bookmark->link->id, $new_link->id; |