6 use Test::More tests => 11;
14 package Foo::Meta::Attribute;
19 extends 'Moose::Meta::Attribute';
25 $next->($self, $name, (is => 'rw', isa => 'Foo'), @_);
33 has 'foo' => (metaclass => 'Foo::Meta::Attribute');
39 my $foo_attr = Foo->meta->get_attribute('foo');
40 isa_ok($foo_attr, 'Foo::Meta::Attribute');
41 isa_ok($foo_attr, 'Moose::Meta::Attribute');
43 is($foo_attr->name, 'foo', '... got the right name for our meta-attribute');
44 ok($foo_attr->has_accessor, '... our meta-attrubute created the accessor for us');
46 ok($foo_attr->has_type_constraint, '... our meta-attrubute created the type_constraint for us');
48 my $foo_attr_type_constraint = $foo_attr->type_constraint;
49 isa_ok($foo_attr_type_constraint, 'Moose::Meta::TypeConstraint');
51 is($foo_attr_type_constraint->name, 'Foo', '... got the right type constraint name');
52 is($foo_attr_type_constraint->parent->name, 'Object', '... got the right type constraint parent name');
55 package Bar::Meta::Attribute;
60 extends 'Class::MOP::Attribute';
68 has 'bar' => (metaclass => 'Bar::Meta::Attribute');
69 } '... the attribute metaclass need not be a Moose::Meta::Attribute as long as it behaves';