X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi-t%2Fconstruct.t;h=e824b064afcd15aef0a7142fbde7f9de44a10107;hb=2d7a4e4642b546553e33e6b780228258279594a7;hp=59adef1d622eaf9df53e631ebcbd41565509489a;hpb=e60dc79fcd4d6318e83584b826526e65048b86a9;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/cdbi-t/construct.t b/t/cdbi-t/construct.t index 59adef1..e824b06 100644 --- a/t/cdbi-t/construct.t +++ b/t/cdbi-t/construct.t @@ -6,7 +6,7 @@ use Test::More; BEGIN { eval "use DBIx::Class::CDBICompat;"; plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") - : (tests=> 4); + : (tests=> 5); } INIT { @@ -14,18 +14,32 @@ INIT { use Film; } -Film->insert({ - Title => "Breaking the Waves", - Director => 'Lars von Trier', - Rating => 'R' -}); +{ + Film->insert({ + Title => "Breaking the Waves", + Director => 'Lars von Trier', + Rating => 'R' + }); -my $film = Film->construct({ - Title => "Breaking the Waves", - Director => 'Lars von Trier', -}); + my $film = Film->construct({ + Title => "Breaking the Waves", + Director => 'Lars von Trier', + }); -isa_ok $film, "Film"; -is $film->title, "Breaking the Waves"; -is $film->director, "Lars von Trier"; -is $film->rating, "R", "constructed objects can get missing data from the db"; \ No newline at end of file + isa_ok $film, "Film"; + is $film->title, "Breaking the Waves"; + is $film->director, "Lars von Trier"; + is $film->rating, "R", + "constructed objects can get missing data from the db"; +} + +{ + package Foo; + use base qw(Film); + Foo->columns( TEMP => qw(temp_thing) ); + my $film = Foo->construct({ + temp_thing => 23 + }); + + ::is $film->temp_thing, 23, "construct sets temp columns"; +}