Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / t / cdbi / has_many_loads_foreign_class.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
83eef562 2use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
3
4656f62f 4use strict;
4a233f30 5use warnings;
4656f62f 6
83eef562 7use Test::More;
4656f62f 8
50891152 9use lib 't/cdbi/testlib';
817ac9e9 10use DBICTest::Util 'class_seems_loaded';
4656f62f 11use Director;
12
83eef562 13# Test that has_many() will load the foreign class
817ac9e9 14ok ! class_seems_loaded('Film'), 'Start non-loaded';
83eef562 15ok eval { Director->has_many( films => 'Film' ); 1; } or diag $@;
4656f62f 16
17my $shan_hua = Director->create({
18 Name => "Shan Hua",
19});
20
21my $inframan = Film->create({
22 Title => "Inframan",
23 Director => "Shan Hua",
24});
25my $guillotine2 = Film->create({
26 Title => "Flying Guillotine 2",
27 Director => "Shan Hua",
28});
29my $guillotine = Film->create({
30 Title => "Master of the Flying Guillotine",
31 Director => "Yu Wang",
32});
33
d9bd5195 34is_deeply [sort $shan_hua->films], [sort $inframan, $guillotine2];
35
36done_testing;