From: Amiri Barksdale Date: Wed, 2 Jun 2010 00:45:19 +0000 (+0000) Subject: Finish ViewDeps: fix a join in test class, put attribs on Parser, add resultset tests... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=339f7f5d918753b488b7cca97cb9b8b72e2e5f16;p=dbsrgits%2FDBIx-Class-Historic.git Finish ViewDeps: fix a join in test class, put attribs on Parser, add resultset tests for 105view_deps.t, use memory store for SQLite. --- diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index 433a27f..fc95801 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -453,9 +453,15 @@ Limit the amount of parsed sources by supplying an explicit list of source names L, L -=head1 AUTHORS +=head1 AUTHOR -See L. +Jess Robinson + +=head2 CONTRIBUTORS + +Matt Trout +Ash Berlin +Amiri Barksdale =head1 LICENSE diff --git a/t/105view_deps.t b/t/105view_deps.t index c285c94..7905bd5 100644 --- a/t/105view_deps.t +++ b/t/105view_deps.t @@ -28,7 +28,7 @@ for (@sql_files) { ok( unlink($_), "Deleted old SQL $_ OK" ); } -my $schema = ViewDeps->connect( 'dbi:SQLite:dbname=t/var/viewdeps.db', +my $schema = ViewDeps->connect( 'dbi:SQLite::memory:', { quote_char => '"', } ); ok( $schema, 'Connected to ViewDeps schema OK' ); @@ -77,4 +77,22 @@ my @sqlt_sources = is_deeply(\@sorted_sources,\@sqlt_sources,"SQLT view order triumphantly matches our order."); +#################### AND WHAT ABOUT USING THE SCHEMA? + +my $a_name_rs = $schema->resultset('ANameArtists'); +my $ab_name_rs = $schema->resultset('AbNameArtists'); +my $aba_name_rs = $schema->resultset('AbaNameArtists'); +my $aba_name_cds_rs = $schema->resultset('AbaNameArtistsAnd2010CDsWithManyTracks'); +my $track_five_rs = $schema->resultset('TrackNumberFives'); +my $year_2010_rs = $schema->resultset('Year2010CDs'); +my $year_2010_cds_rs = $schema->resultset('Year2010CDsWithManyTracks'); + +ok($a_name_rs, "ANameArtists resultset is OK"); +ok($ab_name_rs, "AbNameArtists resultset is OK"); +ok($aba_name_rs, "AbaNameArtists resultset is OK"); +ok($aba_name_cds_rs, "AbaNameArtistsAnd2010CDsWithManyTracks resultset is OK"); +ok($track_five_rs, "TrackNumberFives resultset is OK"); +ok($year_2010_rs, "Year2010CDs resultset is OK"); +ok($year_2010_cds_rs, "Year2010CDsWithManyTracks resultset is OK"); + done_testing; diff --git a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm index 82313c5..c6e4144 100644 --- a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm +++ b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm @@ -8,7 +8,7 @@ use base 'ViewDeps::Result::Year2010CDs'; __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); __PACKAGE__->table('year_2010_cds_with_many_tracks'); __PACKAGE__->result_source_instance->view_definition( - "SELECT cd.id,cd.title,cd.artist,cd.year,cd.number_tracks,art.id FROM year_2010_cds cd,artwork art WHERE cd.number_tracks > 10 AND art.cd = cd.id" + "SELECT cd.id,cd.title,cd.artist,cd.year,cd.number_tracks,art.file FROM year_2010_cds cd JOIN artwork art on art.cd = cd.id WHERE cd.number_tracks > 10" ); __PACKAGE__->result_source_instance->deploy_depends_on( @@ -20,7 +20,7 @@ __PACKAGE__->add_columns( artist => { data_type => 'integer', is_nullable => 0 }, year => { data_type => 'integer' }, number_tracks => { data_type => 'integer' }, - artwork => { data_type => 'integer' }, + file => { data_type => 'integer' }, ); __PACKAGE__->set_primary_key('id');