[Bast-commits] r4187 - DBIx-Class/0.08/trunk/t/cdbi-t
schwern at dev.catalyst.perl.org
schwern at dev.catalyst.perl.org
Thu Mar 13 18:49:58 GMT 2008
Author: schwern
Date: 2008-03-13 18:49:57 +0000 (Thu, 13 Mar 2008)
New Revision: 4187
Modified:
DBIx-Class/0.08/trunk/t/cdbi-t/construct.t
Log:
Test the behavior of construct() with temp columns.
Modified: DBIx-Class/0.08/trunk/t/cdbi-t/construct.t
===================================================================
--- DBIx-Class/0.08/trunk/t/cdbi-t/construct.t 2008-03-12 21:29:58 UTC (rev 4186)
+++ DBIx-Class/0.08/trunk/t/cdbi-t/construct.t 2008-03-13 18:49:57 UTC (rev 4187)
@@ -6,7 +6,7 @@
BEGIN {
eval "use DBIx::Class::CDBICompat;";
plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 4);
+ : (tests=> 5);
}
INIT {
@@ -14,18 +14,32 @@
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";
+}
More information about the Bast-commits
mailing list