X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Funit_core_container_get_all_component_services.t;fp=t%2Faggregate%2Funit_core_container_get_all_component_services.t;h=ffe172b2881e9d30c1257fc49c1afeed9375641a;hp=b97c57f4d1e41f07cf03789dfe979d79b4e1f48a;hb=dcc2a475181033f04a873c85a370842277de44f1;hpb=666d15c12b89ca3b35625e59110ef2eddf7cabf0 diff --git a/t/aggregate/unit_core_container_get_all_component_services.t b/t/aggregate/unit_core_container_get_all_component_services.t index b97c57f..ffe172b 100644 --- a/t/aggregate/unit_core_container_get_all_component_services.t +++ b/t/aggregate/unit_core_container_get_all_component_services.t @@ -19,6 +19,7 @@ use warnings; # } use Test::More; +use Scalar::Util 'blessed'; use Test::Moose; use FindBin '$Bin'; use lib "$Bin/../lib"; @@ -76,15 +77,15 @@ while (my ($class, $info) = each %$expected) { my %singleton_component_classes; can_ok($c, 'get_all_singleton_lifecycle_components'); -ok(my @singleton_comps = $c->get_all_singleton_lifecycle_components, 'singleton components are fetched'); -foreach my $comp (@singleton_comps) { - blessed_ok($comp, "it's an object"); - my $class = ref $comp; +ok(my $singleton_comps = $c->get_all_singleton_lifecycle_components, 'singleton components are fetched'); +while (my ($class, $comp) = each %$singleton_comps) { + ok(blessed $comp, "it's an object"); # it just happens this particular app has all components as objects, so I test it remains true + is($class, ref $comp, "of class $class"); ok(exists $expected->{$class}, "it's one of the existing components"); ok(!exists $singleton_component_classes{$class}, "it's the first instance of class $class"); $singleton_component_classes{$class} = 1; } -is_deeply([ keys %$expected ], [ keys %singleton_component_classes ]); +is_deeply([ sort keys %$expected ], [ sort keys %singleton_component_classes ], 'all components returned'); done_testing;