From: Amiri Barksdale Date: Thu, 3 Jun 2010 14:15:37 +0000 (+0000) Subject: Committing thing for move to git. X-Git-Tag: v0.08124~114^2~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a8525be6ae7f16a4dc9283008fd9ae71da36371;p=dbsrgits%2FDBIx-Class.git Committing thing for move to git. --- diff --git a/t/105view_deps.t b/t/105view_deps.t index 7905bd5..223254d 100644 --- a/t/105view_deps.t +++ b/t/105view_deps.t @@ -23,13 +23,8 @@ can_ok( $view, $_ ) for qw/new from deploy_depends_on/; #################### DEPS -my @sql_files = glob("t/sql/ViewDeps*.sql"); -for (@sql_files) { - ok( unlink($_), "Deleted old SQL $_ OK" ); -} - -my $schema = ViewDeps->connect( 'dbi:SQLite::memory:', - { quote_char => '"', } ); +my $schema + = ViewDeps->connect( 'dbi:SQLite::memory:', { quote_char => '"', } ); ok( $schema, 'Connected to ViewDeps schema OK' ); my $deps_ref = { @@ -43,56 +38,35 @@ my $deps_ref = { } @{ [ $schema->sources ] } }; -my @sorted_sources = - sort { - keys %{ $deps_ref->{$a} || {} } - <=> - keys %{ $deps_ref->{$b} || {} } +my @sorted_sources = sort { + keys %{ $deps_ref->{$a} || {} } <=> keys %{ $deps_ref->{$b} || {} } || $a cmp $b } keys %$deps_ref; #################### DEPLOY -my $ddl_dir = "t/sql"; -$schema->create_ddl_dir( [ 'PostgreSQL', 'MySQL', 'SQLite' ], 0.1, $ddl_dir ); - -ok( -e $_, "$_ was created successfully" ) for @sql_files; - $schema->deploy( { add_drop_table => 1 } ); #################### DOES ORDERING WORK? my $tr = $schema->{sqlt}; -my @keys = keys %{$tr->{views}}; +my @keys = keys %{ $tr->{views} }; -my @sqlt_sources = - sort { - $tr->{views}->{$a}->{order} - cmp - $tr->{views}->{$b}->{order} - } +my @sqlt_sources + = sort { $tr->{views}->{$a}->{order} cmp $tr->{views}->{$b}->{order} } @keys; -is_deeply(\@sorted_sources,\@sqlt_sources,"SQLT view order triumphantly matches our order."); +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"); +lives_ok( sub { $schema->resultset($_)->next }, "Query on $_ succeeds" ) + for grep { + $schema->resultset($_) + ->result_source->isa('DBIx::Class::ResultSource::View') + } @{ [ $schema->sources ] }; done_testing;