The Rules_ban sub-module defines one condition and two actions. These are not currently covered by any functional tests, they only have unit tests. This is fine for testing that they work, but deprecation warnings such as 'Providing context definitions via the "context" key is deprecated in Drupal 8.7.x' are not triggered. This was discovered in #3106468: Missed replacing one use of 'context' with 'context_definitions

Rules Ban does not need to have it's own functional tests just for the form checking, because the actions and conditions can simply be added into the existing ConditionsFormTest and ActionsFormTest classes.

CommentFileSizeAuthor
#5 3110461-5.rules-ban-tests.patch1.58 KBjonathan1055

Comments

jonathan1055 created an issue. See original summary.

tr’s picture

Issue summary: View changes
jonathan1055’s picture

I can't see what was changed on the "view changes" linked page. Was there something important I missed?
Working on a patch right now.

tr’s picture

No, it is silly. I just added a space because if I don't respond at all then the drupal.org statistics on the project page will reflect negatively on how well this project is being supported.

jonathan1055’s picture

Issue summary: View changes
Status: Active » Needs review
Related issues: +#3106468: Missed replacing one use of 'context' with 'context_definitions
StatusFileSize
new1.58 KB

OK that's a good answer. Maybe it would be nice if clicking 'follow' would record that the maintainer has responded.

Here is a patch which adds the condition and actions. Locally I confirm that without this commit to fix the missed context_definitions the test output shows:

 19x: Providing context definitions via the "context" key is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use the "context_definitions" key instead.
    19x in ConditionsFormTest::testConditionsFormWidgets from Drupal\Tests\rules\Functional

This is because there are 19 tests (19 items in the data provider array) and I guess each condition is evaluated or loaded (or whatever) even though the bad condition is only used in one test.

The deprecation warning is no longer shown when using the latest -dev.

  • TR committed 5b38fc4 on 8.x-3.x authored by jonathan1055
    Issue #3110461 by jonathan1055: Add rules_ban actions and conditions to...
tr’s picture

Status: Needs review » Fixed

Thanks. Committed.

Status: Fixed » Closed (fixed)

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