The blog test does:
// Confirm a blog feed was displayed.
$this->drupalGet('blog/feed');
$this->assertTitle(t('Drupal blogs'), t('Blog feed was displayed'));
// Confirm a blog feed was displayed per user.
$this->drupalGet('blog/' . $user->uid . '/feed');
$this->assertTitle(t("@name's blog", array('@name' => $user->name)), t('User blog feed was displayed'));
Effectively trying to use HTML assertions on RSS content. I'm not sure it really makes sense, but certainly break HTML validation, as shown by #402254: How do we do on XHTML validation?.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | assertTitleXml-405258-2.patch | 1.16 KB | naxoc |
Comments
Comment #1
sreynen commentedTo add a bit more explanation to this, assertTitle() calls xpath(), which calls parse(), which parses the document with DOMDocument::loadHTML(), which throws an error when used with RSS instead of HTML.
I'd suggest assertTitle should be usable with non-HTML documents, and to remove the loadHTML() errors, simpletest should be updated to use loadXML() in cases where $content is XML rather than assuming it's always HTML, e.g. by saving the returned MIME type in curlExec().
Comment #2
naxoc commentedDo we need validation of the xml? Would the easy solution be to use
assertRaw()instead? I don't know how many places in the tests this is an issue, but it works fine in the attached patch for the blog test.