Marcel GrĂ¼nauer

NAME

Data::Domain::SemanticAdapter::Test - testing Data::Domain objects

VERSION

version 1.100840

DESCRIPTION

This class can be used to test classes derived from Data::Domain::SemanticAdapter. It works in conjunction with Test::CompanionClasses.

METHODS

munge_args

Test data classes usually define TESTDATA() to have arguments without leading dashes. This method munges the args to the usual Data::Domain style by prepending a dash to those keys that don't already start with a dash.

So if the TESTDATA() looks like this:

    use constant TESTDATA => (
        {
            args => { foo => 1, bar => 'baz' },
            valid => [ qw(
                ...
            ) ],
            invalid => [ qw(
                ...
            ) ],
        },
    );

the data domain object to be passed will effectively be constructed like this:

    $self->make_real_object('-foo' => 1', '-bar' => 'baz');

make_real_object() comes from Test::CompanionClasses::Base.

test_is_valid

Overrides this method by passing the value to be tested to the data domain object's inspect() method and checking that it either returns an empty string or 0.

test_is_invalid

Overrides this method by passing the value to be tested to the data domain object's inspect() method and checking that it returns an INVALID message as defined in Data::Domain.

is_excluded

Takes a data domain object and a value to be tested. Passes the value to the data domain object's inspect() method and checks whether it returns an EXCLUSION_SET message as defined in Data::Domain.

is_invalid

Takes a data domain object and a value to be tested. Passes the value to the data domain object's inspect() method and checks whether it returns an INVALID message as defined in Data::Domain.

This method differs from test_is_invalid() in that the latter is called while iterating over TESTDATA() and so it gets a test name as an argument, while this method can be used for custom tests - it creates its own test name.

is_valid

Analogous to is_invalid().

INSTALLATION

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Data-Domain-SemanticAdapter.

AVAILABILITY

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Data-Domain-SemanticAdapter/.

The development version lives at http://github.com/hanekomu/Data-Domain-SemanticAdapter/. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

  Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Marcel Gruenauer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.