Fix incorrect whitespace test outside of checkouts
[dbsrgits/DBIx-Class.git] / t / 78self_referencial.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
70350518 3use strict;
8273e845 4use warnings;
70350518 5
6use Test::More;
c0329273 7
70350518 8use DBICTest;
9
a47e1233 10my $schema = DBICTest->init_schema();
70350518 11
12# this test will check to see if you can have 2 columns
13# in the same class pointing at the same other class
14#
15# example:
16#
17# +---------+ +--------------+
18# | SelfRef | | SelfRefAlias |
19# +---------+ 1-M +--------------+
20# | id |-------| self_ref | --+
21# | name | | alias | --+
22# +---------+ +--------------+ |
23# /|\ |
24# | |
25# +--------------------------------+
26#
27# see http://use.perl.org/~LTjake/journal/24876 for the
28# issue with CDBI
29
30plan tests => 4;
31
32my $item = $schema->resultset("SelfRef")->find( 1 );
33is( $item->name, 'First', 'proper start item' );
34
35my @aliases = $item->aliases;
36
37is( scalar @aliases, 1, 'proper number of aliases' );
38
39my $orig = $aliases[ 0 ]->self_ref;
40my $alias = $aliases[ 0 ]->alias;
41
42is( $orig->name, 'First', 'proper original' );
43is( $alias->name, 'Second', 'proper alias' );
44