New namespace::clean to resolve the Package::Stash megafail
[dbsrgits/DBIx-Class.git] / t / relationship / after_update.t
CommitLineData
e60dc79f 1use strict;
5e8cb53c 2use warnings;
e60dc79f 3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7
8my $schema = DBICTest->init_schema();
9
10plan tests => 2;
11
12my $bookmark = $schema->resultset("Bookmark")->find(1);
13my $link = $bookmark->link;
14my $link_id = $link->id;
15
16my $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);
25is $bookmark->link->id, $new_link->id;
26
27$bookmark->update;
28is $bookmark->link->id, $new_link->id;