From: Jess Robinson Date: Thu, 19 Feb 2009 22:04:06 +0000 (+0000) Subject: Add view test. X-Git-Tag: v0.08240~88^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bccd177fabb721d4edf637c0b5024737b6705edb;p=dbsrgits%2FDBIx-Class.git Add view test. Only check is_virtual on view sources --- diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 835edbb..bff7ddc 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -69,10 +69,10 @@ sub parse { my(@table_monikers, @view_monikers); for my $moniker (@monikers){ my $source = $dbicschema->source($moniker); - next if $source->is_virtual; if ( $source->isa('DBIx::Class::ResultSource::Table') ) { push(@table_monikers, $moniker); } elsif( $source->isa('DBIx::Class::ResultSource::View') ){ + next if $source->is_virtual; push(@view_monikers, $moniker); } } diff --git a/t/104view.t b/t/104view.t new file mode 100644 index 0000000..f800af4 --- /dev/null +++ b/t/104view.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::More; +use Test::Exception; +use lib qw(t/lib); +use DBICTest; + +my $schema = DBICTest->init_schema(); + +plan tests => 1; + +my $cds_rs = $schema->resultset('CD')->search( { year => 2000 }); +my $year2kcds_rs = $schema->resultset('Year2000CDs'); + +is($cds_rs->count, $year2kcds_rs->count, 'View Year2000CDs sees all CDs in year 2000'); + + + diff --git a/t/lib/DBICTest/Schema/Year2000CDs.pm b/t/lib/DBICTest/Schema/Year2000CDs.pm index be91397..5293c69 100644 --- a/t/lib/DBICTest/Schema/Year2000CDs.pm +++ b/t/lib/DBICTest/Schema/Year2000CDs.pm @@ -1,5 +1,6 @@ package # hide from PAUSE DBICTest::Schema::Year2000CDs; +## Used in 104view.t use base 'DBIx::Class::Core'; use DBIx::Class::ResultSource::View;