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=b97c57f4d1e41f07cf03789dfe979d79b4e1f48a;hp=7f381c1708111e92b6128e76b2416cf467b78afc;hb=666d15c12b89ca3b35625e59110ef2eddf7cabf0;hpb=456f6735048a4d18be96b3dff3480e9368405ec0 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 7f381c1..b97c57f 100644 --- a/t/aggregate/unit_core_container_get_all_component_services.t +++ b/t/aggregate/unit_core_container_get_all_component_services.t @@ -74,4 +74,17 @@ while (my ($class, $info) = each %$expected) { isa_ok($received_info->{backcompat_service}, $info->{bcpt_service_isa}, 'backcompat_service'); } +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(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 ]); + done_testing;