=head1 NAME
Test::Interface - Test if a class implements an interface
=head1 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();
=head1 DESCRIPTION
Test if a class implements an interface, using L<Role::Inspector>
=head1 SEE ALSO
=over
=item L<Role::MethodReturns>
A bad attempt for writing readable interfaces.
=item L<Role::Inspector>
Introspection for roles, providing C<does_role>.
=item L<Role::Tiny>
A minimalist role composition tool.
=item L<Test::Role>
Which works fine for objects, but not for classes.
=back
=head1 AUTHOR
Theo van Hoesel <tvanhoesel@perceptyx.com>
=head1 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.
=cut