X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frelationship%2Fcore.t;h=566e5f32d8a4d818c92b930996172d41d3316a9e;hb=a33d2444e0981129eb060521de27c5e2104f37ba;hp=65093c41ff95557278f2356514d88994b889c193;hpb=fd30f112753ccadd44937c71f386a6aba47a0bee;p=dbsrgits%2FDBIx-Class.git diff --git a/t/relationship/core.t b/t/relationship/core.t index 65093c4..566e5f3 100644 --- a/t/relationship/core.t +++ b/t/relationship/core.t @@ -7,8 +7,9 @@ use lib qw(t/lib); use DBICTest; my $schema = DBICTest->init_schema(); +my $sdebug = $schema->storage->debug; -plan tests => 78; +plan tests => 79; # has_a test my $cd = $schema->resultset("CD")->find(4); @@ -40,8 +41,8 @@ if ($INC{'DBICTest/HelperRels.pm'}) { year => 2005, } ); - SKIP:{ - skip "Can't fix right now", 1 if $DBIx::Class::VERSION < 0.09; + TODO: { + local $TODO = "Can't fix right now" if $DBIx::Class::VERSION < 0.09; lives_ok { $big_flop->genre} "Don't throw exception when col is not loaded after insert"; }; } @@ -57,7 +58,7 @@ is( $big_flop_cd->title, 'Big Flop', 'create_related ok' ); is($queries, 0, 'No SELECT made for belongs_to if key IS NULL'); $big_flop_cd->genre_inefficient; #should trigger a select query is($queries, 1, 'SELECT made for belongs_to if key IS NULL when undef_on_null_fk disabled'); - $schema->storage->debug(0); + $schema->storage->debug($sdebug); $schema->storage->debugcb(undef); } @@ -275,11 +276,11 @@ my $searched = $mapped_rs->search({'mapped_artists.artistid' => {'!=', undef}}); cmp_ok($searched->count, '==', 2, "Both artist returned from map after adding another condition"); -# check join through cascaded has_many relationships +# check join through cascaded has_many relationships (also empty has_many rels) $artist = $schema->resultset("Artist")->find(1); my $trackset = $artist->cds->search_related('tracks'); -# LEFT join means we also see the trackless additional album... -cmp_ok($trackset->count, '==', 11, "Correct number of tracks for artist"); +is($trackset->count, 10, "Correct number of tracks for artist"); +is($trackset->all, 10, "Correct number of track objects for artist"); # now see about updating eveything that belongs to artist 2 to artist 3 $artist = $schema->resultset("Artist")->find(2);