1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
10 my $schema = DBICTest->init_schema();
12 # this test will check to see if you can have 2 columns
13 # in the same class pointing at the same other class
17 # +---------+ +--------------+
18 # | SelfRef | | SelfRefAlias |
19 # +---------+ 1-M +--------------+
20 # | id |-------| self_ref | --+
21 # | name | | alias | --+
22 # +---------+ +--------------+ |
25 # +--------------------------------+
27 # see http://use.perl.org/~LTjake/journal/24876 for the
32 my $item = $schema->resultset("SelfRef")->find( 1 );
33 is( $item->name, 'First', 'proper start item' );
35 my @aliases = $item->aliases;
37 is( scalar @aliases, 1, 'proper number of aliases' );
39 my $orig = $aliases[ 0 ]->self_ref;
40 my $alias = $aliases[ 0 ]->alias;
42 is( $orig->name, 'First', 'proper original' );
43 is( $alias->name, 'Second', 'proper alias' );