FailIfACCEPT_CONTEXTCalled role
[catagits/Catalyst-Runtime.git] / t / lib / TestCustomContainer.pm
index 266b267..2bcbdfe 100644 (file)
@@ -42,7 +42,7 @@ sub BUILD {
     is(get('/container_isa'), $self->container_class,   'and container isa our container class');
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 1
+        # DefaultSetup ACCEPT_CONTEXT called - total: 1
         ok(my ($res, $c) = ctx_request('/get_model_baz'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Baz', 'content is expected');
@@ -52,18 +52,18 @@ sub BUILD {
         is($baz->accept_context_called, 1, 'ACCEPT_CONTEXT called');
         isa_ok($baz->foo, 'TestAppCustomContainer::Model::Foo', 'Baz got Foo ok');
 
-        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
-        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
-        is($foo->baz_got_it, 1, 'Baz accessed Foo once');
+#        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
+#        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
+#        is($foo->baz_got_it, 1, 'Baz accessed Foo once');
 
-        # Foo ACCEPT_CONTEXT called - total: 2
+        # DefaultSetup ACCEPT_CONTEXT called - total: 2
         ok(get('/get_model_baz'), 'another request');
         is($baz->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (instance per context)');
-        is($foo->baz_got_it, 2, 'Baz accessed Foo again');
+#        is($foo->baz_got_it, 2, 'Baz accessed Foo again');
     }
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 3
+        # DefaultSetup ACCEPT_CONTEXT called - total: 3
         ok(my ($res, $c) = ctx_request('/get_model_bar'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Bar', 'content is expected');
@@ -75,27 +75,27 @@ sub BUILD {
         is($bar->accept_context_called, 1, 'ACCEPT_CONTEXT called');
         isa_ok($bar->foo, 'TestAppCustomContainer::Model::Foo', 'Bar got Foo ok');
 
-        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
-        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
-        is($foo->bar_got_it, 1, 'Bar accessed Foo once');
+#        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
+#        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
+#        is($foo->bar_got_it, 1, 'Bar accessed Foo once');
 
-        # Foo ACCEPT_CONTEXT *not* called - total: 3
+        # DefaultSetup ACCEPT_CONTEXT *not* called - total: 3
         ok(get('/get_model_bar'), 'another request');
         is($bar->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (lifecycle is Singleton)');
-        is($foo->bar_got_it, 1, 'Bar didn\'t access Foo again');
+#        is($foo->bar_got_it, 1, 'Bar didn\'t access Foo again');
     }
 
     {
-        # Foo ACCEPT_CONTEXT called - total: 4
+        # DefaultSetup ACCEPT_CONTEXT called - total: 4
         ok(my ($res, $c) = ctx_request('/get_model_foo'), 'request');
         ok($res->is_success, 'request 2xx');
         is($res->content, 'TestAppCustomContainer::Model::Foo', 'content is expected');
 
-        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
-        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
-        is($foo->accept_context_called, 4, 'ACCEPT_CONTEXT called');
-        is($foo->bar_got_it, 1, 'Bar accessed Foo once');
-        is($foo->baz_got_it, 2, 'Baz accessed Foo twice');
+#        ok(my $foo = $c->container->get_sub_container('component')->resolve(service => 'model_Foo'), 'fetching Foo');
+#        isa_ok($foo, 'TestAppCustomContainer::Model::Foo');
+#        is($foo->accept_context_called, 4, 'ACCEPT_CONTEXT called');
+#        is($foo->bar_got_it, 1, 'Bar accessed Foo once');
+#        is($foo->baz_got_it, 2, 'Baz accessed Foo twice');
     }
 
     done_testing;