You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
J. King
7011bc0c4d
|
4 years ago | |
---|---|---|
.. | ||
Parser | 4 years ago | |
Util | 4 years ago | |
HttpClientTest.php | 4 years ago | |
README.md | 4 years ago |
README.md
The Lax test suite
Feed parsing tests
The tests under the JSON
, XML
, and HTTP
directories are parser tests
with a shared format and test harness. The test harness is largely contained
in the AbstractParserTestCase.php
file, which contains the logic to
transform the tests themselves into native PHP input and output.
Tests are series of YAML files each containing a map (an object), each entry an individual test which is itself a map. Tests have the following keys:
input
: The test input as a string, or a map (see below)output
: The result of the parsing upon success; described in more detail belowexception
: The exception ID thrown upon failuretype
: An HTTP Content-Type (with or without parameters) for the documentdoc_url
: A fictitious URL where a newsfeed might be located, used for relative URL resolution
The 'input' key along with either 'output' or 'exception' are required for all tests. All other keys may or may not be omitted in a test.
The test output is necessarily mangled due to the limits of YAML:
- Any field which should be an absolute URL is written as a string; relative URLs are represented as a sequence with the relative part first, followed by the base that is be applied to it
- Any collections are represented as sequences of maps
- Rich text can either be supplied as a string (which represents a Text object with plain-text content) or as a map with any of the properties of the Text class listed
If the test input is a map, it represents a response from an HTTP server, with the following keys:
status
: The response status code. This is usually omitted and should be assumed to be 200 unless specifiedhead
: The map of header-field in the response. Each entry may be a string, or a sequence of stringsbody
: The message body as a a string; it may be omitted if not relevant to the functionality being tested