From: Rafael Kitover Date: Sat, 24 Sep 2011 14:05:22 +0000 (-0400) Subject: fix preserve_case tests in common tests X-Git-Tag: 0.07011~41 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=f213ae4e7851d8c6525b08d935d88fc46e6ac8c2 fix preserve_case tests in common tests Rescans with preserve_case option reset to the original value after doing a rescan with preserve_case set to 1 and running the preserve_case tests. Failure to do so was breaking the Oracle extra tests. --- diff --git a/Changes b/Changes index 3cae070..7e79d47 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - fix Oracle common tests fail with multi_schema due to not resetting + the preserve_case option after the preserve_case tests (RT#70829) - handle DEFAULT NULL for Pg - handle boolean DEFAULT 0::boolean for Pg - config file support for dbicdump script diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 7911ac2..ff5efe6 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -114,7 +114,7 @@ sub run_tests { my $extra_count = $self->{extra}{count} || 0; my $col_accessor_map_tests = 5; - my $num_rescans = 5; + my $num_rescans = 6; $num_rescans++ if $self->{vendor} eq 'mssql'; $num_rescans++ if $self->{vendor} eq 'Firebird'; @@ -1254,9 +1254,10 @@ qq| INSERT INTO ${oqt}${table41_name}${cqt} VALUES (1, 1) |, ); $conn->storage->disconnect; - local $conn->loader->{preserve_case} = 1; - $conn->loader->_setup; + my $orig_preserve_case = $conn->loader->preserve_case; + $conn->loader->preserve_case(1); + $conn->loader->_setup; $self->rescan_without_warnings($conn); if (not $self->{skip_rels}) { @@ -1273,6 +1274,13 @@ qq| INSERT INTO ${oqt}${table41_name}${cqt} VALUES (1, 1) |, is try { $conn->resultset('LoaderTest40')->find(1)->foo3_bar }, 'foo', 'accessor for mixed-case column name in mixed case table'; } + + # Further tests may expect preserve_case to be unset, so reset it to the + # original value and rescan again. + + $conn->loader->preserve_case($orig_preserve_case); + $conn->loader->_setup; + $self->rescan_without_warnings($conn); } sub monikers_and_classes {