See #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)

Needs at least partial conversion to KernelTestBase We need to do something different then use setRawContent to test the rendered entities.

The one webtest in text module depends on \Drupal\field\Tests\String\StringFieldTest in the field module. Lets use this issue to convert these two tests which might make the field module conversion a little easier, which can't hurt.

Scope:
- \Drupal\field\Tests\String\StringFieldTest
- \Drupal\text\Tests\TextFieldTest

CommentFileSizeAuthor
#8 2870462-8.patch4.8 KBLendude
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michielnugter created an issue. See original summary.

michielnugter’s picture

michielnugter’s picture

Component: phpunit » text.module
Issue tags: +phpunit initiative

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Lendude’s picture

Issue summary: View changes
Status: Postponed » Active

The one webtest in the text module extends \Drupal\field\Tests\String\StringFieldTest.

Instead of postponing on the field issue, lets just make \Drupal\field\Tests\String\StringFieldTest part of this issue, since its otherwise just a one test conversion.

Edit: Thanks @Nick Wilde for pointing this out on Slack!

Lendude’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
4.8 KB

So something like this. I didn't do a kernel test for the couple of times setRawContent was used because it was just checking for a string in a rendered entity which we can just do using assertContains.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Something like that looks great.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed df94b0c1ef to 8.7.x and a12a80c7d3 to 8.6.x. Thanks!

  • alexpott committed df94b0c on 8.7.x
    Issue #2870462 by Lendude, michielnugter: Convert web tests to browser...

  • alexpott committed a12a80c on 8.6.x
    Issue #2870462 by Lendude, michielnugter: Convert web tests to browser...

Status: Fixed » Closed (fixed)

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