[Bast-commits] r3364 - in branches/DBIx-Class-current:
lib/DBIx/Class t
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Tue May 22 17:24:15 GMT 2007
Author: groditi
Date: 2007-05-22 17:24:15 +0100 (Tue, 22 May 2007)
New Revision: 3364
Modified:
branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm
branches/DBIx-Class-current/t/97result_class.t
Log:
fix to t/97result_class.t and fixed tests too
Modified: branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm
===================================================================
--- branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm 2007-05-22 16:13:07 UTC (rev 3363)
+++ branches/DBIx-Class-current/lib/DBIx/Class/ResultSet.pm 2007-05-22 16:24:15 UTC (rev 3364)
@@ -1618,9 +1618,13 @@
my $join_count = $seen->{$rel};
my $alias = ($join_count > 1 ? join('_', $rel, $join_count) : $rel);
+ #XXX - temp fix for result_class bug. There likely is a more elegant fix -groditi
+ my %attrs = %{$self->{attrs}||{}};
+ delete $attrs{result_class};
+
$self->_source_handle->schema->resultset($rel_obj->{class})->search_rs(
undef, {
- %{$self->{attrs}||{}},
+ %attrs,
join => undef,
prefetch => undef,
select => undef,
Modified: branches/DBIx-Class-current/t/97result_class.t
===================================================================
--- branches/DBIx-Class-current/t/97result_class.t 2007-05-22 16:13:07 UTC (rev 3363)
+++ branches/DBIx-Class-current/t/97result_class.t 2007-05-22 16:24:15 UTC (rev 3364)
@@ -7,7 +7,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 7;
+plan tests => 9;
{
my $cd_rc = $schema->resultset("CD")->result_class;
@@ -18,8 +18,14 @@
my $cd_rs = $artist_rs->related_resultset('cds');
is($cd_rs->result_class, $cd_rc, 'Correct cd result_class');
+
+ my $cd_rs2 = $schema->resultset("Artist")->search_rs({})->related_resultset('cds');
+ is($cd_rs->result_class, $cd_rc, 'Correct cd2 result_class');
+
+ my $cd_rs3 = $schema->resultset("Artist")->search_rs({},{})->related_resultset('cds');
+ is($cd_rs->result_class, $cd_rc, 'Correct cd3 result_class');
- isa_ok(eval {$cd_rs->find(1) }, $cd_rc, 'Inflated into correct cd result_class');
+ isa_ok(eval{ $cd_rs->find(1) }, $cd_rc, 'Inflated into correct cd result_class');
}
@@ -27,12 +33,12 @@
my $cd_rc = $schema->resultset("CD")->result_class;
my $artist_rs = $schema->resultset("Artist")
- ->search_rs({}, {result_class => "IWillExplode"})->search({artistis => 1});
+ ->search_rs({}, {result_class => "IWillExplode"})->search({artistid => 1});
is($artist_rs->result_class, 'IWillExplode', 'Correct artist result_class');
my $cd_rs = $artist_rs->related_resultset('cds');
is($cd_rs->result_class, $cd_rc, 'Correct cd result_class');
isa_ok(eval{ $cd_rs->find(1) }, $cd_rc, 'Inflated into correct cd result_class');
- isa_ok(eval { $cd_rs->search({ cdid => 1 })->first}, $cd_rc, 'Inflated into correct cd result_class');
+ isa_ok(eval{ $cd_rs->search({ cdid => 1 })->first }, $cd_rc, 'Inflated into correct cd result_class');
}
More information about the Bast-commits
mailing list