NAME
Test::Interface - Test if a class implements an interface
SYNOPSIS
To create an Interface:
package MyProject::Foo::Interface;
use Role::MethodReturns;
around my_foo_method => class_method ( Str, $foo, Int $bar ) {
returns_object_does_interface( 'MyProject::Bar::Interface'(
$original->( $class => ( $foo, $bar ) )
}
And in some implementation:
package MyProject::Foo
sub my_foo_method { ... }
...
And in tests:
use Test::Most;
use Test::Interface;
interface_ok('MyProject::Foo', 'MyProject::Foo::Interface',
"huray! We implemented all methods!!"
done_testing();
DESCRIPTION
Test if a class implements an interface, using Role::Inspector
SEE ALSO
- Role::MethodReturns
-
A bad attempt for writing readable interfaces.
- Role::Inspector
-
Introspection for roles, providing
does_role
. - Role::Tiny
-
A minimalist role composition tool.
- Test::Role
-
Which works fine for objects, but not for classes.
AUTHOR
Theo van Hoesel <tvanhoesel@perceptyx.com>
COPYRIGHT AND LICENSE
'Test::Interface' is Copyright (C) 2020, Perceptyx Inc
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This library is distributed in the hope that it will be useful, but it is provided "as is" and without any express or implied warranties.
For details, see the full text of the license in the file LICENSE.