use Test::Exception;
use lib qw(t/lib);
use ViewDeps;
-use Devel::Dwarn;
-use Data::Dumper;
-use Carp::Always;
BEGIN {
- #$ENV{DBIC_TRACE} = 1;
use_ok('DBIx::Class::ResultSource::View');
}
#################### 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" );
} @{ [ $schema->sources ] }
};
-#diag( Dwarn $deps_ref);
-
-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;
-#diag( Dwarn @sorted_sources );
-
#################### DEPLOY
my $ddl_dir = "t/sql";
#################### DOES ORDERING WORK?
my $tr = $schema->{sqlt};
-#diag("My TR isa: ", ref $tr);
-#diag( Dwarn keys %{$tr->{views}});
-my @keys = keys %{$tr->{views}};
+my @keys = keys %{$tr->{views}};
my @sqlt_sources =
-sort {
- $tr->{views}->{$a}->{order} cmp $tr->{views}->{$b}->{order}
-}
-@keys;
-
-#diag(Dwarn @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.");