use C3 in the tests also
[catagits/Catalyst-Component-ACCEPT_CONTEXT.git] / t / preserve-object.t
CommitLineData
75f37967 1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5use Test::More tests => 4;
6
7my $app = { app => 'oh yeah' };
8
9my $foo = Foo->COMPONENT($app, { args => 'yes' });
10is $foo->{args}, 'yes', 'foo created';
11is $foo->context->{app}, 'oh yeah', 'got app';
12
13my $ctx = { ctx => 'it is' };
14my $foo2 = $foo->ACCEPT_CONTEXT($ctx);
15is $foo, $foo2, 'foo and foo2 are the same ref';
16is $foo->context->{ctx}, 'it is', 'got ctx';
17
18{
19 package Foo;
20 use base qw/Catalyst::Component::ACCEPT_CONTEXT Catalyst::Component/;
21
22 sub new {
23 my $class = shift;
9180b019 24 return $class->next::method(@_);
75f37967 25 }
26
27}