[Bast-commits] r7193 - in
DBIx-Class/0.08/branches/multicreate_fixes: . t/multi_create
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Aug 4 13:48:34 GMT 2009
Author: ribasushi
Date: 2009-08-04 13:48:33 +0000 (Tue, 04 Aug 2009)
New Revision: 7193
Added:
DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/diamond.t
Modified:
DBIx-Class/0.08/branches/multicreate_fixes/Makefile.PL
DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/multilev_single_PKeqFK.t
Log:
Separate the diamond MC test
Use the new Test::More's no_plan ability
Modified: DBIx-Class/0.08/branches/multicreate_fixes/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/multicreate_fixes/Makefile.PL 2009-08-04 13:39:05 UTC (rev 7192)
+++ DBIx-Class/0.08/branches/multicreate_fixes/Makefile.PL 2009-08-04 13:48:33 UTC (rev 7193)
@@ -13,7 +13,7 @@
test_requires 'Test::Builder' => 0.33;
test_requires 'Test::Deep' => 0;
test_requires 'Test::Exception' => 0;
-test_requires 'Test::More' => 0.82;
+test_requires 'Test::More' => 0.92;
test_requires 'Test::Warn' => 0.11;
# Core
Copied: DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/diamond.t (from rev 7191, DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/multilev_single_PKeqFK.t)
===================================================================
--- DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/diamond.t (rev 0)
+++ DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/diamond.t 2009-08-04 13:48:33 UTC (rev 7193)
@@ -0,0 +1,52 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use lib qw(t/lib);
+use DBICTest;
+
+sub mc_diag { diag (@_) if $ENV{DBIC_MULTICREATE_DEBUG} };
+
+my $schema = DBICTest->init_schema();
+
+mc_diag (<<'DG');
+* Try a diamond multicreate
+
+Artist -> has_many -> Artwork_to_Artist -> belongs_to
+ /
+ belongs_to <- CD <- belongs_to <- Artwork <-/
+ \
+ \-> Artist2
+
+DG
+
+lives_ok (sub {
+ $schema->resultset ('Artist')->create ({
+ name => 'The wooled wolf',
+ artwork_to_artist => [{
+ artwork => {
+ cd => {
+ title => 'Wool explosive',
+ year => 1999,
+ artist => { name => 'The black exploding sheep' },
+ }
+ }
+ }],
+ });
+
+ my $art2 = $schema->resultset ('Artist')->find ({ name => 'The black exploding sheep' });
+ ok ($art2, 'Second artist exists');
+
+ my $cd = $art2->cds->single;
+ is ($cd->title, 'Wool explosive', 'correctly created CD');
+
+ is_deeply (
+ [ $cd->artwork->artists->get_column ('name')->all ],
+ [ 'The wooled wolf' ],
+ 'Artist correctly attached to artwork',
+ );
+
+}, 'Diamond chain creation ok');
+
+done_testing;
Modified: DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/multilev_single_PKeqFK.t
===================================================================
--- DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/multilev_single_PKeqFK.t 2009-08-04 13:39:05 UTC (rev 7192)
+++ DBIx-Class/0.08/branches/multicreate_fixes/t/multi_create/multilev_single_PKeqFK.t 2009-08-04 13:48:33 UTC (rev 7193)
@@ -8,8 +8,6 @@
sub mc_diag { diag (@_) if $ENV{DBIC_MULTICREATE_DEBUG} };
-plan tests => 30;
-
my $schema = DBICTest->init_schema();
mc_diag (<<'DG');
@@ -102,43 +100,4 @@
}, "multilevel $type with a PK == FK in the $type/has_many table ok");
}
-
-mc_diag (<<'DG');
-* Try a diamond multicreate
-
-Artist -> has_many -> Artwork_to_Artist -> belongs_to
- /
- belongs_to <- CD <- belongs_to <- Artwork <-/
- \
- \-> Artist2
-
-DG
-
-lives_ok (sub {
- $schema->resultset ('Artist')->create ({
- name => 'The wooled wolf',
- artwork_to_artist => [{
- artwork => {
- cd => {
- title => 'Wool explosive',
- year => 1999,
- artist => { name => 'The black exploding sheep' },
- }
- }
- }],
- });
-
- my $art2 = $schema->resultset ('Artist')->find ({ name => 'The black exploding sheep' });
- ok ($art2, 'Second artist exists');
-
- my $cd = $art2->cds->single;
- is ($cd->title, 'Wool explosive', 'correctly created CD');
-
- is_deeply (
- [ $cd->artwork->artists->get_column ('name')->all ],
- [ 'The wooled wolf' ],
- 'Artist correctly attached to artwork',
- );
-
-}, 'Diamond chain creation ok');
-
+done_testing;
\ No newline at end of file
More information about the Bast-commits
mailing list