[Bast-commits] r6890 - in DBIx-Class/0.08/branches/extended_rels/t: . lib/DBICTest/Schema relationship

mo at dev.catalyst.perl.org mo at dev.catalyst.perl.org
Tue Jun 30 17:45:50 GMT 2009


Author: mo
Date: 2009-06-30 17:45:49 +0000 (Tue, 30 Jun 2009)
New Revision: 6890

Removed:
   DBIx-Class/0.08/branches/extended_rels/t/zzzzzzz_sqlite_deadlock.t
Modified:
   DBIx-Class/0.08/branches/extended_rels/t/lib/DBICTest/Schema/Artist.pm
   DBIx-Class/0.08/branches/extended_rels/t/relationship/core.t
Log:
failing test

Modified: DBIx-Class/0.08/branches/extended_rels/t/lib/DBICTest/Schema/Artist.pm
===================================================================
--- DBIx-Class/0.08/branches/extended_rels/t/lib/DBICTest/Schema/Artist.pm	2009-06-30 17:37:05 UTC (rev 6889)
+++ DBIx-Class/0.08/branches/extended_rels/t/lib/DBICTest/Schema/Artist.pm	2009-06-30 17:45:49 UTC (rev 6890)
@@ -40,7 +40,22 @@
     cds => 'DBICTest::Schema::CD', undef,
     { order_by => 'year' },
 );
+
+
 __PACKAGE__->has_many(
+    cds_80s => 'DBICTest::Schema::CD',
+    sub {
+        my ( $rs, $self, $foreign ) = @_;
+        return {
+            "${foreign}.artist" => "${self}.artistid",
+            "${foreign}.year"   => { '>', "1979" },
+            "${foreign}.year"   => { '<', "1990" }
+        };
+    }
+);
+
+
+__PACKAGE__->has_many(
     cds_unordered => 'DBICTest::Schema::CD'
 );
 

Modified: DBIx-Class/0.08/branches/extended_rels/t/relationship/core.t
===================================================================
--- DBIx-Class/0.08/branches/extended_rels/t/relationship/core.t	2009-06-30 17:37:05 UTC (rev 6889)
+++ DBIx-Class/0.08/branches/extended_rels/t/relationship/core.t	2009-06-30 17:45:49 UTC (rev 6890)
@@ -8,7 +8,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 78;
+plan tests => 85;
 
 # has_a test
 my $cd = $schema->resultset("CD")->find(4);
@@ -309,3 +309,14 @@
 
 $cds = $schema->resultset("CD")->search({ 'me.cdid' => 5 }, { join => { single_track => { cd => {} } } });
 is($cds->count, 1, "subjoins under left joins force_left (hashref)");
+
+$artist = $schema->resultset("Artist")->create({ name => 'Michael Jackson' });
+foreach my $year (1975..1985) {
+  $artist->create_related('cds', { year => $year, title => 'Compilation from ' . $year });
+}
+
+my @cds_80s = $artist->cds_80s;
+
+is(@cds_80s, 6, '6 80s cds found');
+
+map { ok($_->year < 1990 && $_->year > 1979) } @cds_80s;

Deleted: DBIx-Class/0.08/branches/extended_rels/t/zzzzzzz_sqlite_deadlock.t
===================================================================
--- DBIx-Class/0.08/branches/extended_rels/t/zzzzzzz_sqlite_deadlock.t	2009-06-30 17:37:05 UTC (rev 6889)
+++ DBIx-Class/0.08/branches/extended_rels/t/zzzzzzz_sqlite_deadlock.t	2009-06-30 17:45:49 UTC (rev 6890)
@@ -1,35 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use Test::Exception;
-use lib 't/lib';
-
-use File::Temp ();
-use DBICTest;
-use DBICTest::Schema;
-
-plan tests => 2;
-my $wait_for = 10;  # how many seconds to wait
-
-for my $close (0,1) {
-
-  my $tmp = File::Temp->new( UNLINK => 1, TMPDIR => 1, SUFFIX => '.sqlite' );
-  my $tmp_fn = $tmp->filename;
-  close $tmp if $close;
-
-  local $SIG{ALRM} = sub { die sprintf (
-    "Timeout of %d seconds reached (tempfile still open: %s)",
-    $wait_for, $close ? 'No' : 'Yes'
-  )};
-
-  alarm $wait_for;
-
-  lives_ok (sub {
-    my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn");
-    DBICTest->deploy_schema ($schema);
-    DBICTest->populate_schema ($schema);
-  });
-
-  alarm 0;
-}




More information about the Bast-commits mailing list