add TODO on constraint check
[dbsrgits/DBIx-Class.git] / t / cdbi-t / has_many_loads_foreign_class.t
CommitLineData
4656f62f 1use strict;
2use Test::More;
3
4
5BEGIN {
6 eval "use DBIx::Class::CDBICompat;";
7 plan skip_all => 'Class::Trigger and DBIx::ContextualFetch required' if $@;
8 eval "use DBD::SQLite";
9 plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 3);
10}
11
12
13use lib 't/testlib';
14use Director;
15
16# Test that has_many() will load the foreign class.
17ok !Class::Inspector->loaded( 'Film' );
18ok eval { Director->has_many( films => 'Film' ); 1; } || diag $@;
19
20my $shan_hua = Director->create({
21 Name => "Shan Hua",
22});
23
24my $inframan = Film->create({
25 Title => "Inframan",
26 Director => "Shan Hua",
27});
28my $guillotine2 = Film->create({
29 Title => "Flying Guillotine 2",
30 Director => "Shan Hua",
31});
32my $guillotine = Film->create({
33 Title => "Master of the Flying Guillotine",
34 Director => "Yu Wang",
35});
36
37is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];