Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / relationship / after_update.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 use DBICTest;
9
10 my $schema = DBICTest->init_schema();
11
12 plan tests => 2;
13
14 my $bookmark = $schema->resultset("Bookmark")->find(1);
15 my $link = $bookmark->link;
16 my $link_id = $link->id;
17
18 my $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);
27 is $bookmark->link->id, $new_link->id;
28
29 $bookmark->update;
30 is $bookmark->link->id, $new_link->id;