6 use Test::More tests => 11;
14 package Foo::Meta::Attribute;
17 extends 'Moose::Meta::Attribute';
23 $next->($self, $name, (is => 'rw', isa => 'Foo'), @_);
29 has 'foo' => (metaclass => 'Foo::Meta::Attribute');
35 my $foo_attr = Foo->meta->get_attribute('foo');
36 isa_ok($foo_attr, 'Foo::Meta::Attribute');
37 isa_ok($foo_attr, 'Moose::Meta::Attribute');
39 is($foo_attr->name, 'foo', '... got the right name for our meta-attribute');
40 ok($foo_attr->has_accessor, '... our meta-attrubute created the accessor for us');
42 ok($foo_attr->has_type_constraint, '... our meta-attrubute created the type_constraint for us');
44 my $foo_attr_type_constraint = $foo_attr->type_constraint;
45 isa_ok($foo_attr_type_constraint, 'Moose::Meta::TypeConstraint');
47 is($foo_attr_type_constraint->name, 'Foo', '... got the right type constraint name');
48 is($foo_attr_type_constraint->parent->name, 'Object', '... got the right type constraint parent name');
51 package Bar::Meta::Attribute;
54 extends 'Class::MOP::Attribute';
60 has 'bar' => (metaclass => 'Bar::Meta::Attribute');
61 } '... the attribute metaclass need not be a Moose::Meta::Attribute as long as it behaves';