[Bast-commits] r9531 - in
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t:
. lib
amiri at dev.catalyst.perl.org
amiri at dev.catalyst.perl.org
Tue Jun 1 23:05:29 GMT 2010
Author: amiri
Date: 2010-06-02 00:05:29 +0100 (Wed, 02 Jun 2010)
New Revision: 9531
Modified:
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/lib/ViewDeps.pm
Log:
Finish sort order comparison in 105view_deps.t.
Modified: DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t
===================================================================
--- DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t 2010-06-01 22:35:15 UTC (rev 9530)
+++ DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t 2010-06-01 23:05:29 UTC (rev 9531)
@@ -12,11 +12,11 @@
use Carp::Always;
BEGIN {
- $ENV{DBIC_TRACE} = 1;
+ #$ENV{DBIC_TRACE} = 1;
use_ok('DBIx::Class::ResultSource::View');
}
-### SANITY
+#################### SANITY
my $view = DBIx::Class::ResultSource::View->new( { name => 'Quux' } );
@@ -25,10 +25,12 @@
can_ok( $view, $_ ) for qw/new from deploy_depends_on/;
-### DEPS
+#################### DEPS
+
#if (-e "t/var/viewdeps.db") {
#ok(unlink("t/var/viewdeps.db"),"Deleted old DB OK");
#}
+
my @sql_files = glob("t/sql/ViewDeps*.sql");
for (@sql_files) {
ok( unlink($_), "Deleted old SQL $_ OK" );
@@ -40,7 +42,7 @@
my $deps_ref = {
map {
- $schema->resultset($_)->result_source->source_name =>
+ $schema->resultset($_)->result_source->name =>
$schema->resultset($_)->result_source->deploy_depends_on
}
grep {
@@ -49,7 +51,7 @@
} @{ [ $schema->sources ] }
};
-diag( Dwarn $deps_ref);
+#diag( Dwarn $deps_ref);
my @sorted_sources = sort {
keys %{ $deps_ref->{$a} || {} } <=> keys %{ $deps_ref->{$b} || {} }
@@ -57,9 +59,9 @@
}
keys %$deps_ref;
-diag( Dwarn @sorted_sources );
+#diag( Dwarn @sorted_sources );
-### DEPLOY
+#################### DEPLOY
my $ddl_dir = "t/sql";
$schema->create_ddl_dir( [ 'PostgreSQL', 'MySQL', 'SQLite' ], 0.1, $ddl_dir );
@@ -68,12 +70,22 @@
$schema->deploy( { add_drop_table => 1 } );
-### DOES ORDERING WORK?
+#################### DOES ORDERING WORK?
-my $tr = SQL::Translator->new( add_drop_table => 1 );
-$tr->{parser_args}->{'DBIx::Class::Schema'} = $schema;
-my $sqlt = SQL::Translator::Parser::DBIx::Class::parse( $tr, $schema );
+my $tr = $schema->{sqlt};
+#diag("My TR isa: ", ref $tr);
+#diag( Dwarn keys %{$tr->{views}});
+my @keys = keys %{$tr->{views}};
-diag( Dwarn $sqlt); # Nope. A 1.
+my @sqlt_sources =
+sort {
+ $tr->{views}->{$a}->{order} cmp $tr->{views}->{$b}->{order}
+}
+ at keys;
+
+#diag(Dwarn @sqlt_sources);
+
+is_deeply(\@sorted_sources,\@sqlt_sources,"SQLT view order triumphantly matchs our order.");
+
done_testing;
Modified: DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/lib/ViewDeps.pm
===================================================================
--- DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/lib/ViewDeps.pm 2010-06-01 22:35:15 UTC (rev 9530)
+++ DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/lib/ViewDeps.pm 2010-06-01 23:05:29 UTC (rev 9531)
@@ -8,4 +8,9 @@
__PACKAGE__->load_namespaces;
+sub sqlt_deploy_hook {
+ my $self = shift;
+ $self->{sqlt} = shift;
+}
+
1;
More information about the Bast-commits
mailing list