Problem/Motivation

_theme() is deprecated, but \Drupal\simpletest\WebTestBase::assertThemeOutput() is still basically a wrapper around _theme().

Proposed resolution

Add a new helper method to WebTestBase (maybe assertRenderOutput()) for checking the output of render arrays. I found assertRenderedElement() in \Drupal\system\Tests\Common\RenderWebTest but that is using XPath which I'm not sure whether we want to use or not.

Remaining tasks

Discuss
Create the patch
Patch review

User interface changes

n/a

API changes

Adds a new helper to WebTestBase for checking theme output.

Comments

sun’s picture

Title: Add a helper method to \Drupal\simpletest\WebTestBase for checking the output of render arrays and deprecate assertThemeOutput() » Add a helper method to WebTestBase for checking the output of render arrays and deprecate assertThemeOutput()

I agree that assertThemeOutput() is not an appropriate test helper method anymore. I guess we should remove it.

#2257519: Move content assertion methods into a trait, so DUTB can consume it, too is about to add a render() method that will be exposed to both WebTestBase and DrupalUnitTestBase, which allows to call drupal_render() on an arbitrary render element array AND immediately use that as the "content" of the "internal browser" → assertRaw(), assertText(), etc.pp. will work natively, without having to perform any additional operations. :-)

Beyond that, I don't know whether we need additional helper methods, but perfectly possible + I'd love to discuss here :-)

sun’s picture

Status: Active » Closed (duplicate)