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/proc/self/root/usr/share/doc/perl-DBIx-Class/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

use Test::More;
use lib qw(t/lib);
use DBICTest;

my $schema = DBICTest->init_schema();

# this test will check to see if you can have 2 columns
# in the same class pointing at the same other class
#
# example:
#
# +---------+       +--------------+
# | SelfRef |       | SelfRefAlias |
# +---------+  1-M  +--------------+
# | id      |-------| self_ref     | --+
# | name    |       | alias        | --+
# +---------+       +--------------+   |
#    /|\                               |
#     |                                |
#     +--------------------------------+
#
# see http://use.perl.org/~LTjake/journal/24876 for the
# issue with CDBI

plan tests => 4;

my $item = $schema->resultset("SelfRef")->find( 1 );
is( $item->name, 'First', 'proper start item' );

my @aliases = $item->aliases;

is( scalar @aliases, 1, 'proper number of aliases' );

my $orig  = $aliases[ 0 ]->self_ref;
my $alias = $aliases[ 0 ]->alias;

is( $orig->name, 'First', 'proper original' );
is( $alias->name, 'Second', 'proper alias' );


Hry