initial merge of Schwern's CDBICompat work, with many thanks
[dbsrgits/DBIx-Class.git] / t / cdbi-t / construct.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test::More;
5
6 BEGIN {
7   eval "use DBIx::Class::CDBICompat;";
8   plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
9           : (tests=> 4);
10 }
11
12 INIT {
13     use lib 't/testlib';
14     use Film;
15 }
16
17 Film->insert({
18     Title     => "Breaking the Waves",
19     Director  => 'Lars von Trier',
20     Rating    => 'R'
21 });
22
23 my $film = Film->construct({
24     Title     => "Breaking the Waves",
25     Director  => 'Lars von Trier',
26 });
27
28 isa_ok $film, "Film";
29 is $film->title, "Breaking the Waves";
30 is $film->director, "Lars von Trier";
31 is $film->rating, "R", "constructed objects can get missing data from the db";