From: Rafael Kitover Date: Wed, 6 May 2009 03:13:56 +0000 (+0000) Subject: fix ::DBI::Replicated::all_storages X-Git-Tag: v0.08103~83^2~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6412a5927691e6b8e3370edeb06ed3ef79c757b3;p=dbsrgits%2FDBIx-Class.git fix ::DBI::Replicated::all_storages --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 59e74dc..a25b2a4 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -412,7 +412,7 @@ sub all_storages { my $self = shift @_; return grep {defined $_ && blessed $_} ( $self->master, - $self->replicants, + values %{ $self->replicants }, ); } diff --git a/t/93storage_replication.t b/t/93storage_replication.t index 422a445..f6d2be6 100644 --- a/t/93storage_replication.t +++ b/t/93storage_replication.t @@ -10,7 +10,7 @@ BEGIN { eval "use DBIx::Class::Storage::DBI::Replicated; use Test::Moose"; plan $@ ? ( skip_all => "Deps not installed: $@" ) - : ( tests => 79 ); + : ( tests => 82 ); } use_ok 'DBIx::Class::Storage::DBI::Replicated::Pool'; @@ -223,6 +223,15 @@ ok my @replicant_connects = $replicated->generate_replicant_connect_info ok my @replicated_storages = $replicated->schema->storage->connect_replicants(@replicant_connects) => 'Created some storages suitable for replicants'; + +ok my @all_storages = $replicated->schema->storage->all_storages + => '->all_storages'; + +ok @all_storages == 3 + => 'correct number of ->all_storages'; + +ok ((grep $_->isa('DBIx::Class::Storage::DBI'), @all_storages) == 3 + => '->all_storages are correct type'); my @replicant_names = keys %{ $replicated->schema->storage->replicants };