Marcel Grünauer == hanekomu (跳ね込む) > Data-Domain-SemanticAdapter-0.01 > Data::Domain::SemanticAdapter::Test

Download:
Data-Domain-SemanticAdapter-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01   Source  

NAME ^

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

SYNOPSIS ^

    Data::Domain::SemanticAdapter::Test->new;

DESCRIPTION ^

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

Data::Domain::SemanticAdapter::Test inherits from Data::Semantic::Test.

The superclass Data::Semantic::Test defines these methods and functions:

    PLAN(), run()

The superclass Test::CompanionClasses::Base defines these methods and functions:

    new(), clear_package(), make_real_object(), package(), package_clear(),
    planned_test_count()

The superclass Class::Accessor::Complex defines these methods and functions:

    carp(), cluck(), croak(), flatten(), mk_abstract_accessors(),
    mk_array_accessors(), mk_boolean_accessors(),
    mk_class_array_accessors(), mk_class_hash_accessors(),
    mk_class_scalar_accessors(), mk_concat_accessors(),
    mk_forward_accessors(), mk_hash_accessors(), mk_integer_accessors(),
    mk_new(), mk_object_accessors(), mk_scalar_accessors(),
    mk_set_accessors(), mk_singleton()

The superclass Class::Accessor defines these methods and functions:

    _carp(), _croak(), _mk_accessors(), accessor_name_for(),
    best_practice_accessor_name_for(), best_practice_mutator_name_for(),
    follow_best_practice(), get(), make_accessor(), make_ro_accessor(),
    make_wo_accessor(), mk_accessors(), mk_ro_accessors(),
    mk_wo_accessors(), mutator_name_for(), set()

The superclass Class::Accessor::Installer defines these methods and functions:

    install_accessor(), subname()

The superclass Data::Inherited defines these methods and functions:

    every_hash(), every_list(), flush_every_cache_by_key()

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 effectlvely 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

Analoguous to is_invalid().

TAGS ^

If you talk about this module in blogs, on del.icio.us or anywhere else, please use the datadomainsemanticadapter tag.

VERSION ^

This document describes version 0.01 of Data::Domain::SemanticAdapter::Test.

BUGS AND LIMITATIONS ^

No bugs have been reported.

Please report any bugs or feature requests to <bug-data-domain-semanticadapter@rt.cpan.org>, or through the web interface at http://rt.cpan.org.

INSTALLATION ^

See perlmodinstall for information and options on installing Perl modules.

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://www.perl.com/CPAN/authors/id/M/MA/MARCEL/>.

AUTHOR ^

Marcel Grünauer, <marcel@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2007 by Marcel Grünauer

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