[Bast-commits] r8186 - in branches/DBIx-Class-Schema-Loader/current:
lib/DBIx/Class/Schema/Loader t t/backcompat/0.04006
t/backcompat/0.04006/lib
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Wed Dec 30 20:58:07 GMT 2009
Author: caelum
Date: 2009-12-30 20:58:06 +0000 (Wed, 30 Dec 2009)
New Revision: 8186
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
branches/DBIx-Class-Schema-Loader/current/t/20invocations.t
branches/DBIx-Class-Schema-Loader/current/t/24loader_subclass.t
branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/20invocations.t
branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/22dump.t
branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm
Log:
fix tests
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-12-30 20:58:06 UTC (rev 8186)
@@ -417,7 +417,7 @@
my ($v) = $real_ver =~ /([1-9])/;
$v = "v$v";
- last if $v eq CURRENT_V;
+ last if $v eq CURRENT_V || $real_ver =~ /^0\.04999/;
if (not %{ $self->naming }) {
warn <<"EOF" unless $ENV{SCHEMA_LOADER_BACKCOMPAT};
Modified: branches/DBIx-Class-Schema-Loader/current/t/20invocations.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/20invocations.t 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/t/20invocations.t 2009-12-30 20:58:06 UTC (rev 8186)
@@ -28,6 +28,7 @@
'hardcode' => sub {
package DBICTest::Schema::5;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connection($make_dbictest_db::dsn);
__PACKAGE__;
},
@@ -35,13 +36,14 @@
package DBICTest::Schema::6;
use base qw/ DBIx::Class::Schema::Loader /;
__PACKAGE__->loader_options();
+ __PACKAGE__->naming('current');
__PACKAGE__->connect($make_dbictest_db::dsn);
},
'make_schema_at' => sub {
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'DBICTest::Schema::7',
- { really_erase_my_files => 1 },
+ { really_erase_my_files => 1, naming => 'current' },
[ $make_dbictest_db::dsn ],
);
DBICTest::Schema::7->clone;
@@ -49,6 +51,7 @@
'embedded_options' => sub {
package DBICTest::Schema::8;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect(
$make_dbictest_db::dsn,
{ loader_options => { really_erase_my_files => 1 } }
@@ -57,6 +60,7 @@
'embedded_options_in_attrs' => sub {
package DBICTest::Schema::9;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect(
$make_dbictest_db::dsn,
undef,
@@ -71,7 +75,10 @@
{ },
[
$make_dbictest_db::dsn,
- { loader_options => { really_erase_my_files => 1 } },
+ { loader_options => {
+ really_erase_my_files => 1,
+ naming => 'current'
+ } },
],
);
"DBICTest::Schema::10";
@@ -79,7 +86,10 @@
'almost_embedded' => sub {
package DBICTest::Schema::11;
use base qw/ DBIx::Class::Schema::Loader /;
- __PACKAGE__->loader_options( really_erase_my_files => 1 );
+ __PACKAGE__->loader_options(
+ really_erase_my_files => 1,
+ naming => 'current'
+ );
__PACKAGE__->connect(
$make_dbictest_db::dsn,
undef, undef, { AutoCommit => 1 }
@@ -89,7 +99,7 @@
use DBIx::Class::Schema::Loader;
DBIx::Class::Schema::Loader::make_schema_at(
'DBICTest::Schema::12',
- { really_erase_my_files => 1 },
+ { really_erase_my_files => 1, naming => 'current' },
[ $make_dbictest_db::dsn ],
);
DBICTest::Schema::12->clone;
Modified: branches/DBIx-Class-Schema-Loader/current/t/24loader_subclass.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/24loader_subclass.t 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/t/24loader_subclass.t 2009-12-30 20:58:06 UTC (rev 8186)
@@ -12,19 +12,21 @@
loader_class => sub {
package DBICTest::Schema::1;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->loader_class(shift);
__PACKAGE__->connect($make_dbictest_db::dsn);
},
connect_info => sub {
package DBICTeset::Schema::2;
use base qw/ DBIx::Class::Schema::Loader /;
+ __PACKAGE__->naming('current');
__PACKAGE__->connect($make_dbictest_db::dsn, { loader_class => shift });
},
make_schema_at => sub {
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'DBICTeset::Schema::3',
- { },
+ { naming => 'current' },
[ $make_dbictest_db::dsn, { loader_class => shift } ]
);
}
Modified: branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/20invocations.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/20invocations.t 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/20invocations.t 2009-12-30 20:58:06 UTC (rev 8186)
@@ -6,6 +6,10 @@
plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests'
unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT};
+local $SIG{__WARN__} = sub {
+ warn @_ unless $_[0] =~ /Dynamic schema|really_erase_my_files/;
+};
+
# Takes a $schema as input, runs 4 basic tests
sub test_schema {
my ($testname, $schema) = @_;
Modified: branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/22dump.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/22dump.t 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/22dump.t 2009-12-30 20:58:06 UTC (rev 8186)
@@ -9,6 +9,11 @@
my $dump_path = './t/_dump';
+local $SIG{__WARN__} = sub {
+ warn @_ unless $_[0] =~
+ /^Dumping manual schema|really_erase_my_files|^Schema dump complete/;
+};
+
{
package DBICTest::Schema::1;
use base qw/ DBIx::Class::Schema::Loader /;
Modified: branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm 2009-12-30 17:30:58 UTC (rev 8185)
+++ branches/DBIx-Class-Schema-Loader/current/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm 2009-12-30 20:58:06 UTC (rev 8186)
@@ -88,6 +88,7 @@
my $warn_count = 0;
$warn_count++ if grep /ResultSetManager/, @loader_warnings;
+ $warn_count++ if grep /Dynamic schema detected/, @loader_warnings;
if($self->{skip_rels}) {
is(scalar(@loader_warnings), $warn_count)
@@ -500,10 +501,18 @@
q{ INSERT INTO loader_test30 (id,loader_test2) VALUES(321, 2) },
);
- my $dbh = $self->dbconnect(1);
- $dbh->do($_) for @statements_rescan;
- $dbh->disconnect;
+ {
+ # Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
+ local $SIG{__WARN__} = sub {
+ my $msg = shift;
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ };
+ my $dbh = $self->dbconnect(1);
+ $dbh->do($_) for @statements_rescan;
+ $dbh->disconnect;
+ }
+
my @new = $conn->rescan;
is(scalar(@new), 1);
is($new[0], 'LoaderTest30');
@@ -852,7 +861,7 @@
# Silence annoying but harmless postgres "NOTICE: CREATE TABLE..."
local $SIG{__WARN__} = sub {
my $msg = shift;
- print STDERR $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
+ warn $msg unless $msg =~ m{^NOTICE:\s+CREATE TABLE};
};
$dbh->do($_) for (@statements);
More information about the Bast-commits
mailing list