Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/share/doc/perl-DBIx-Class/t/relationship/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/share/doc/perl-DBIx-Class/t/relationship/after_update.t
use strict;
use warnings;

use Test::More;
use lib qw(t/lib);
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;

Hry