Contentment::Test - Helpers for testing Contentment
use Contentment::Test; my $response = GET('/foo.txt'); my $content = GET_BODY('/index.html');
Provides a bunch of Apache::Test-like helpers without the Apache::Test dependencies.
This class probably has little or no use to end-users and is intended for developers wishing to test Contentment. This documentation is only written with that audience in mind.
Parses the given text using HTML::TokeParser. This parser argument is used to evaluate the given text with some of the other test methods.
This is a helper used by has_tag_with_attrs() and no_tag_with_attrs(), so those are probably the methods you really want.
has_tag_with_attrs()
no_tag_with_attrs()
The $parser is the argument returned by the parse_html() method. The $tag is the name of the tag to look for. The $expected_attrs is a hash of expected attributes names and values. If the values are regular expressions, then they are used to match attribute values. The $put_back_when argument determines under which situation, if any, the token should be put back into the parser. This option can be set to one of the imported constants PUT_BACK_NEVER, PUT_BACK_ON_MISS, PUT_BACK_ON_FIND, or PUT_BACK_ALWAYS.
$parser
parse_html()
$tag
$expected_attrs
$put_back_when
PUT_BACK_NEVER
PUT_BACK_ON_MISS
PUT_BACK_ON_FIND
PUT_BACK_ALWAYS
Returns a true value naming the found token on success or dies with a list of errors on a failure to match.
This is a helper used by has_tag_with_content() and no_tag_with_content(), so those are probably the methods you really want.
has_tag_with_content()
no_tag_with_content()
The $parser is the argument returned by the parse_html() method. The $tag is the name of the tag to look for. The $expected_content is a scalar or regular expression used to match an attribute's content. The $put_back_when argument determines under which situation, if any, the token should be put back into the parser. This option can be set to one of the imported constants PUT_BACK_NEVER, PUT_BACK_ON_MISS, PUT_BACK_ON_FIND, or PUT_BACK_ALWAYS.
$expected_content
This method is used internally by the tests to note the filename and line number of the failure.
This is a test that calls tag_with_attrs() and succeeds when a matching tag is found.
tag_with_attrs()
This is a test that calls tag_with_attrs() and succeeds when no matching tag is found.
This is a test that calls tag_with_content() and succeeds when a matching tag is found.
tag_with_content()
Return the singleton reference to the LWP::UserAgent used by the various HTTP methods of this module.
Returns an absolute URI object using the current host:port information and the given relative address, $rel.
$rel
Returns an HTTP::Response object for the request at the given relative URL.
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Contentment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contentment
CPAN shell
perl -MCPAN -e shell install Contentment
For more information on module installation, please visit the detailed CPAN module installation guide.