$this->assertTitle('foo " bar', t('Title displayed')) fails with the following errors:
SimpleXMLElement::xpath(): Invalid predicate
SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed

This is because the specified title is used in an XPath expression without any escaping, thus making the expression invalid.

This patch fixes this by moving the comparison from XPath to PHP. It also adds a test to node.test that fails without the change to assertTitle().

CommentFileSizeAuthor
assertTitle-1.patch2.9 KBc960657
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

c960657’s picture

Issue tags: +Quick fix
puradata’s picture

Patch works fine. Passes all tests. If I undo the fix drupal_in web_test_case.php the new test fails. This is good. I recommend the patch be accepted.

puradata’s picture

Patch works fine. Passes all tests. If I undo the fix in drupal_web_test_case.php the new test fails. This is good. I recommend the patch be accepted.

I get an errpr when I try to edit my last comment

bdanchilla’s picture

this patch worked for me. passing/failing the new tests as it should

boombatower’s picture

Status: Needs review » Reviewed & tested by the community

Passes tests, two others to vogue for it, and looks good.

Status: Reviewed & tested by the community » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Reviewed & tested by the community

The testbot was having some problems today.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome. Not only did we fix a bug, but we have a test AND the code is much easier to read now. :)

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.