Commit | Line | Data |
7abe3af2 |
1 | use strict; |
2 | use warnings; |
3 | use lib 't/lib'; |
4 | use Test::More qw(no_plan); |
7abe3af2 |
5 | |
6 | BEGIN { use_ok 'MTITest'; } |
7 | |
7abe3af2 |
8 | my $raw_foo = MTITest->source('Raw::Foo'); |
9 | |
10 | is_deeply( |
11 | [ $raw_foo->columns ], |
12 | [ qw(id a) ], |
146ec120 |
13 | 'Columns for raw foo ok: id a' |
7abe3af2 |
14 | ); |
15 | |
4d88a8d7 |
16 | my $raw_bar = MTITest->source('Raw::Bar'); |
17 | |
18 | is_deeply( |
19 | [ $raw_bar->columns ], |
20 | [ qw(id b) ], |
146ec120 |
21 | 'Columns for raw bar ok: id b' |
4d88a8d7 |
22 | ); |
23 | |
24 | ok($raw_bar->has_relationship('parent'), 'parent rel exists'); |
25 | |
26 | my $parent_info = $raw_bar->relationship_info('parent'); |
27 | |
28 | is( |
29 | $parent_info->{source}, 'Raw::Foo', |
30 | 'parent rel points to raw parent' |
31 | ); |
32 | |
e7189506 |
33 | my $foo = MTITest->source('Foo'); |
34 | my $bar = MTITest->source('Bar'); |
4d88a8d7 |
35 | |
e7189506 |
36 | is_deeply( |
37 | [ $foo->columns ], |
38 | [ qw(id a) ], |
39 | 'Columns for mti foo are still the same: id a' |
40 | ); |
41 | |
42 | |
43 | is_deeply( |
44 | [ $bar->columns ], |
45 | [ qw(id a words b) ], |
46 | 'Columns for mti bar now contain those of foo and the mixin: id a words b' |
47 | ); |