5 # first, test if it loads Catalyst::Container when
6 # no custom container exists
8 package ContainerTestApp;
12 __PACKAGE__->setup_config();
13 __PACKAGE__->setup_log();
16 my $container = ContainerTestApp->container;
18 # 'is' instead of 'isa_ok', because I want it to be only Catalyst::Container
19 # and not some subclass
20 is( ref $container, 'Catalyst::IOC::Container', 'The container is Catalyst::IOC::Container, not a subclass');
22 # now, check if it loads the subclass when it exists
24 package CustomContainerTestApp::Container;
26 extends 'Catalyst::IOC::Container';
28 sub my_custom_method { 1 }
32 package CustomContainerTestApp;
34 BEGIN { extends 'Catalyst' };
36 __PACKAGE__->setup_config();
39 $container = CustomContainerTestApp->container;
41 isa_ok($container, 'CustomContainerTestApp::Container');
42 isa_ok($container, 'Catalyst::IOC::Container');
43 can_ok($container, 'my_custom_method');
44 ok( eval { $container->my_custom_method }, 'executes the method correctly');