Final draft of docs... formatting issues and feedback from others.
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 01load.t
index a913536..664c2c5 100644 (file)
@@ -2,18 +2,46 @@ use strict;
 use warnings;
 use lib 't/lib';
 use Test::More qw(no_plan);
-use Data::Dumper; $Data::Dumper::Indent = 1;
 
 BEGIN { use_ok 'MTITest'; }
 
-warn MTITest->sources;
-
 my $raw_foo = MTITest->source('Raw::Foo');
 
 is_deeply(
   [ $raw_foo->columns ],
   [ qw(id a) ],
-  'Columns for raw foo ok'
+  'Columns for raw foo ok: id a'
+);
+
+my $raw_bar = MTITest->source('Raw::Bar');
+
+is_deeply(
+  [ $raw_bar->columns ],
+  [ qw(id b) ],
+  'Columns for raw bar ok: id b'
+);
+
+ok($raw_bar->has_relationship('parent'), 'parent rel exists');
+
+my $parent_info = $raw_bar->relationship_info('parent');
+
+is(
+  $parent_info->{source}, 'Raw::Foo',
+  'parent rel points to raw parent'
 );
 
-warn Dumper $raw_foo->_columns;
+my $foo = MTITest->source('Foo');
+my $bar = MTITest->source('Bar');
+
+is_deeply(
+  [ $foo->columns ],
+  [ qw(id a) ],
+  'Columns for mti foo are still the same: id a'
+);
+
+
+is_deeply(
+  [ $bar->columns ],
+  [ qw(id a words b) ],
+  'Columns for mti bar now contain those of foo and the mixin: id a words b'
+);