Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP tests DOM_NOT_FOUND DOMNode::insertBefore #327

Merged
merged 2 commits into from
Apr 21, 2013

Conversation

dejalatele
Copy link
Contributor

This commit includes 5 new phpTests to check that the error message DOM_NOT_FOUND is properly raised by the method DOMNode::insertBefore(newNode, [refNode]).

Each file covers a different test case

  • DOMNode_insertBefore_error2.phpt: covers the case when refNode is a sibling of the node where newNode wanted to be inserted.
  • DOMNode_insertBefore_error3.phpt: covers the case when refNode is the parent of the node where newNode wanted to be inserted.
  • DOMNode_insertBefore_error4.phpt: covers the case when refNode is a brand new node.
  • DOMNode_insertBefore_error5.phpt: covers the case when refNode is a descendant (not child) of the node where newNode wanted to be inserted.
  • DOMNode_insertBefore_error6.phpt: covers the case when refNode is the node where newNode wanted to be inserted.

Tested in
PHP : /usr/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.5-1ubuntu7.11
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 18:00:43 UTC 2012 i686
INI : /etc/php5/cli/php.ini
More .INIs : /etc/php5/cli/conf.d/curl.ini,/etc/php5/cli/conf.d/pdo.ini
Extra dirs :
VALGRIND : Not used

@DaveRandom
Copy link
Contributor

@laruence book.xml is already included in the test suite for the DOM extension for use in existing tests.

@laruence
Copy link
Member

ah, then I think you test script should open the absolute path of book.xml like other does:

$doc->load(dirname(__FILE__)."/book.xml")

otherwise, the test should be failed

@DaveRandom
Copy link
Contributor

@laruence Is there a good reason not to use __DIR__? Presumably <5.3 support is not required for new tests? I've noticed that I seem to have used dirname(__FILE__) for tests in my own PR because of blind copypasta but I wonder if there is any point in providing BC for tests...?

@dejalatele If you are going to fix this issue in your new tests you may as well fix the same issue here in the same PR. Also there don't appear to be any tests for DOMDocument::load(), DOMDocument::loadXML() or DOMDocument::loadHTMLFile()

@dejalatele
Copy link
Contributor Author

@laruence you are true, my original tests couldn't find the book.xml and failed, but I didn't realized because I ran them in the same directory where the files are located. Just fixed using the absolute path.
@DaveRandom I also fix the issue you suggested in you last comment

@laruence
Copy link
Member

could you please squash the commits into one commit? since your PR bases on master, I also need cherry-pick them into other branches

… is properly raised by the method DOMNode::insertBefore(newNode, [refNode]).

Each file covers a different test case

    DOMNode_insertBefore_error2.phpt: refNode is a sibling of the node where newNode wanted to be inserted.
    DOMNode_insertBefore_error3.phpt: refNode is the parent of the node where newNode wanted to be inserted.
    DOMNode_insertBefore_error4.phpt: refNode is a brand new node.
    DOMNode_insertBefore_error5.phpt: refNode is a descendant (not child) of the node where newNode wanted to be inserted.
    DOMNode_insertBefore_error6.phpt: refNode is the node where newNode wanted to be inserted.
@dejalatele
Copy link
Contributor Author

@laruence rebase of the commits done

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.

4 participants