AssertTrue() and AssertFalse() now only accept boolean arguments.
4x: Support for asserting against non-boolean values in ::assertTrue is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertNotEmpty(). See https://www.drupal.org/node/3082086

Change record https://www.drupal.org/node/3082086

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new2.73 KB

We can replace assertTrue($this->xpath( ... ) with elementExists('xpath', ... )

In local testing the deprecation warnings are no longer shown.

tr’s picture

I think we can do this now ... testing with 8.6/PHP 5.5 to be sure ...

Also, the test result messages that are no longer needed should be added as a comment above the replacement code - I like to keep any documentation/explanation whenever possible, as it makes the code easier to read and follow and makes the intent of the code clear.

jonathan1055’s picture

I thought that the existing two-line comment above each pair of assertions covered both, e.g.

// Edit condition 1, assert that the switch button is shown for value, and
// that the default entry field is regular text entry not a selector.

was enough to cover the loss of "The entry field is plain text input."

But I can re-do the patch with separate comments for each assertion if that's what you prefer.

  • TR committed 28491f8 on 8.x-3.x
    Issue #3098187 by jonathan1055: Deprecations: Replace non-boolean use of...
tr’s picture

Status: Needs review » Fixed

I see. Thanks. Committed.

Status: Fixed » Closed (fixed)

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

jonathan1055’s picture

Assigned: jonathan1055 » Unassigned

Unassigning