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