Test::IOC - Test IOC registries


IOC documentation  | view source Contained in the IOC distribution.

Index


NAME

Top

Test::IOC - Test IOC registries

SYNOPSIS

Top

    use Test::More;
    use Test::IOC;

    use MyIOCStuff;

    service_exists("/app/log_file");
    service_is_literal("/app/log_file");

    service_exists("/app/logger");
    service_is_singleton("/app/logger");
    service_can("/app/logger", qw/warn debug/);

DESCRIPTION

Top

This module provides some simple facilities to test IOC registries for correctness.

CAVEAT

Top

This module is still in development, so use at your own risk. But then again, its for tests, so thats not very risky anyway.

EXPORTS

Top

service_exists $path
container_exists $path

Checks that the path exists in the registry.

service_is $path, $spec
service_isa $path, $class
service_can $path, @methods
service_is_deeply $path, $spec

These methods provide tests akin to Test::More's is, isa_ok, can_ok and is_deeply, except that the first argument is used as a path to fetch from the registry.

service_is_singleton $path
service_is_literal $path
service_is_prototype $path

Checks that the service constructor class is of the right type for lifecycle management.

service_alias_ok $real, $alias

Check that the path $real has an alias $alias

container_list_is $parent_path, \@container_names
service_list_is $parent_path, \@service_names

Check that the child elements under $parent_path are as listed in the service name array reference. The names don't have to be sorte.

get_service_object $path

Utility function to get the IOC::Service object (not the service itself) for a given path.

locate_container $path

Utility function to call locateContainer in IOC::Registry.

locate_service $path

Utility function to call locateService in IOC::Registry.

search_for_container $name

Utility function to call searchForContainer in IOC::Registry.

search_for_service $name

Utility function to call searchForService in IOC::Registry.

BUGS

Top

None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.

AUTHOR

Top

Yuval Kogman

COPYRIGHT AND LICENSE

Top


IOC documentation  | view source Contained in the IOC distribution.