[Bast-commits] r8845 - DBIx-Class/0.08/trunk/t/multi_create
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Mar 2 10:13:54 GMT 2010
Author: ribasushi
Date: 2010-03-02 10:13:54 +0000 (Tue, 02 Mar 2010)
New Revision: 8845
Modified:
DBIx-Class/0.08/trunk/t/multi_create/in_memory.t
Log:
Test belongs_to accessor in-memory tie
Modified: DBIx-Class/0.08/trunk/t/multi_create/in_memory.t
===================================================================
--- DBIx-Class/0.08/trunk/t/multi_create/in_memory.t 2010-03-02 10:09:06 UTC (rev 8844)
+++ DBIx-Class/0.08/trunk/t/multi_create/in_memory.t 2010-03-02 10:13:54 UTC (rev 8845)
@@ -6,8 +6,6 @@
use lib qw(t/lib);
use DBICTest;
-plan tests => 12;
-
my $schema = DBICTest->init_schema();
# Test various new() invocations - this is all about backcompat, making
@@ -46,6 +44,23 @@
}
{
+ my $new_cd = $schema->resultset('CD')->new ({ 'title' => 'Leave Loudly While Singing Off Key', 'year' => 1982});
+ my $new_artist = $schema->resultset("Artist")->new ({ 'name' => 'Depeche Mode 2: Insertion Boogaloo' });
+ $new_cd->artist ($new_artist);
+
+ eval {
+ $new_cd->insert;
+ };
+ is ($@, '', 'CD insertion survives by inserting artist');
+ ok($new_cd->in_storage, 'new_related_cd inserted');
+ ok($new_artist->in_storage, 'artist inserted');
+
+ my $retrieved_cd = $schema->resultset('CD')->find ({ 'title' => 'Leave Loudly While Singing Off Key'});
+ ok ($retrieved_cd, 'CD found in db');
+ is ($retrieved_cd->artist->name, 'Depeche Mode 2: Insertion Boogaloo', 'Correct artist attached to cd');
+}
+
+{
my $new_cd = $schema->resultset("CD")->new_result({});
my $new_related_artist = $new_cd->new_related('artist', { 'name' => 'Marillion',});
lives_ok (
@@ -61,3 +76,5 @@
ok($new_related_artist->in_storage, 'related artist inserted');
ok($new_cd->in_storage, 'cd inserted');
}
+
+done_testing;
More information about the Bast-commits
mailing list