[Bast-commits] r5530 - in DBIx-Class/0.08/branches/views: lib/SQL/Translator/Parser/DBIx t t/lib/DBICTest/Schema

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Thu Feb 19 22:04:06 GMT 2009


Author: castaway
Date: 2009-02-19 22:04:06 +0000 (Thu, 19 Feb 2009)
New Revision: 5530

Added:
   DBIx-Class/0.08/branches/views/t/104view.t
Modified:
   DBIx-Class/0.08/branches/views/lib/SQL/Translator/Parser/DBIx/Class.pm
   DBIx-Class/0.08/branches/views/t/lib/DBICTest/Schema/Year2000CDs.pm
Log:
Add view test.
Only check is_virtual on view sources



Modified: DBIx-Class/0.08/branches/views/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/views/lib/SQL/Translator/Parser/DBIx/Class.pm	2009-02-19 03:04:53 UTC (rev 5529)
+++ DBIx-Class/0.08/branches/views/lib/SQL/Translator/Parser/DBIx/Class.pm	2009-02-19 22:04:06 UTC (rev 5530)
@@ -69,10 +69,10 @@
     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);
       }
     }

Added: DBIx-Class/0.08/branches/views/t/104view.t
===================================================================
--- DBIx-Class/0.08/branches/views/t/104view.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/views/t/104view.t	2009-02-19 22:04:06 UTC (rev 5530)
@@ -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');
+
+
+

Modified: DBIx-Class/0.08/branches/views/t/lib/DBICTest/Schema/Year2000CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/views/t/lib/DBICTest/Schema/Year2000CDs.pm	2009-02-19 03:04:53 UTC (rev 5529)
+++ DBIx-Class/0.08/branches/views/t/lib/DBICTest/Schema/Year2000CDs.pm	2009-02-19 22:04:06 UTC (rev 5530)
@@ -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;




More information about the Bast-commits mailing list