Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (21 sloc) 668 Bytes
BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
use strict;
use warnings;
use Test::More;
use DBICTest;
my $schema = DBICTest->init_schema();
plan tests => 2;
my $bookmark = $schema->resultset("Bookmark")->find(1);
my $link = $bookmark->link;
my $link_id = $link->id;
my $new_link = $schema->resultset("Link")->new({
id => 42,
url => "http://monstersarereal.com",
title => "monstersarereal.com"
});
# Changing a relationship by id rather than by object would cause
# old related_resultsets to be used.
$bookmark->link($new_link->id);
is $bookmark->link->id, $new_link->id;
$bookmark->update;
is $bookmark->link->id, $new_link->id;