This patch attempts to address the fact that DrupalWebTestCase->assertTitle(...) will always fail due to a default site name string being appended to the title.

Specifically, it was the Node preview test that was failing, and this was the core reason.

Attached patch simply appends the string " | Drupal" to the passed-in title, and passes all current tests.

Switching the default and/or Administration themes from the GUI prior to testing has no side-effects for this patch.

CommentFileSizeAuthor
dwtc.patch802 bytesBladeRider

Comments

BladeRider’s picture

Title: assertTitle() in DupalWebTestCase always fails » assertTitle() in DrupalWebTestCase always fails

Fixed spelling in topic title.

dries’s picture

It sounds like we want to fix the callees instead, and keep assertTitle() clean. I say "won't fix".

BladeRider’s picture

@Dries:

Yes, that was my first thought also before I realised that all calls to assertTitle() would have this problem. Seems that putting the burden on the callee would mean multiple possible points-of-failure.

Any other comments, or am I barking up the wrong tree here?

boombatower’s picture

Since the title may not have "| Drupal" on the end...it may have a changed site title (as a test may change) or viewing a page that doesn't append that I think it is better to force the calle to add (although inconvenient)

If anything you could add a parameter like ($title, $sufix = TRUE) and it would add the variable_get('site_name', '') or w/e and then you could turn it off if you need to, but a straight appending of the suffix is bad.

This patch by itself will cause a number of test failure since many test already append | Drupal.

Status: Needs review » Needs work

The last submitted patch failed testing.

dave reid’s picture

Agreed with boombtower in #4. This needs an extra parameter, the default site name appending needs to be able to be disabled so we can test that the function fails when it should, and a patch should included changing all the calls to assertTitle or assertNoTitle in all .test files.

boombatower’s picture

Status: Needs work » Closed (won't fix)

Don't believe this is an issue anymore.