Skip to content

PHPTests for the DOMDocument::load and DOMDocument::loadXML - #359

Closed
dejalatele wants to merge 3 commits into
php:masterfrom
dejalatele:domnodeloadxml2
Closed

dejalatele wants to merge 3 commits into
php:masterfrom
dejalatele:domnodeloadxml2

Conversation

@dejalatele

Copy link
Copy Markdown
Contributor

The tests cover the following cases for both methods:

  • The basic behavior
  • The use of the libxml options: LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS, LIBXML_NOERROR, LIBXML_DTDVALID, LIBXML_DTDLOAD
  • The following not-well formed xml cases:
    • Extra content at the end of the doc
    • Wrong xml version
    • Typo in the tag name
    • Attribute value withot quotation marks
    • Opening and ending tag mismatch

tests for error1: not well formed xml

tests for error2: not well formed xml attribute without colon

tests for error2: not well formed xml, typo

tests for error4: wrong xml version

tests for error5: extra content at the end of the doc

tests libxml_dtd_load

tests libxml_dtd_valid

tests for libdtd_noerror

tests for LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS

the basic behavior

fix comments
@smalyshev

Copy link
Copy Markdown
Contributor

Three of those fail for me:

Test DOMDocument::loadXML() with LIBXML_DTDLOAD option [ext/dom/tests/DOMDocument_loadXML_variation1.phpt]
Test DOMDocument::loadXML() with LIBXML_DTDVALID option [ext/dom/tests/DOMDocument_loadXML_variation2.phpt]
Test DOMDocument::loadXML() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS [ext/dom/tests/DOMDocument_loadXML_variation4.phpt]

with messages like:

Notice: DOMDocument::loadXML(): failed to load external entity "/Users/smalyshev/php-5.4/books.dtd" in Entity, line: 2 in /Users/smalyshev/php-5.4/ext/dom/tests/DOMDocument_loadXML_variation1.php on line 8

Seems that some chdir or something like that is missing.

…directory for the php source code.

It fixs the fail on the load of the dtd in the tests modified by this commit.
@dejalatele

Copy link
Copy Markdown
Contributor Author

I've fix it with the commit above.

@smalyshev

Copy link
Copy Markdown
Contributor

@dejalatele I'm not sure it will always fix it - are you sure current dir is always PHP root dir? tests can be run from anywhere.

@dejalatele

Copy link
Copy Markdown
Contributor Author

@smalyshev I've fixed this issue in the last commit

@php-pulls

Copy link
Copy Markdown

Comment on behalf of stas at php.net:

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants