I noticed that when I tried to clear the Rules cache manually by calling \Drupal::cache('rules'), I get a PHP error.

Rules currently defines a rules.cache cache bin service. From the Cache Bins API page, it looks like module's should define their own cache bins using the cache.nameofbin scheme and a number of cache functions assume that bins are declared in this way by prefixing the bin argument with cache..

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Devin Carlson created an issue. See original summary.

Devin Carlson’s picture

The attached patch renames the current cache bin to match the standards.

Status: Needs review » Needs work

The last submitted patch, 2: rename-cache-bin-2852231-2.patch, failed testing.

jonathan1055’s picture

Hi Devin Carlson,

The error in the tests:
PHPUnit_Framework_Exception: Fatal error: Class Drupal\rules\Ui\RulesUiDefinition contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Component\Plugin\Definition\PluginDefinitionInterface::id, Drupal\Component\Plugin\Definition\PluginDefinitionInterface::getProvider) in /var/www/html/modules/contrib/rules/src/Ui/RulesUiDefinition.php on line 146 is unrelated to your patch change. I am getting exactly the same error in the Rules tests for Scheduler 8.x testing where we implement Rules conditions, actions and events and test them.

I first noticed this fault on 3rd Feb, and it fails at Core 8.4 and 8.3, however the same tests pass at core 8.2. They were all passing OK on 21st Dec 2016, so I guess something changed between those dates (whether in Core or in Rules, I don't know) but we now have a more strict checking on classes and definitions, and Rules module needs to be fixed as in the message text above.

I have raised a Scheduler issue #2851618: Rules automated tests fail at D8.3 and 8.4 to allow us to track the problem, and maybe implement a temporary fix to not run our Rules tests for the time being, as this fault is affecting every test run and hence every patch we try to test.

Jonathan
[Scheduler module maintainer]

TR’s picture

Status: Needs work » Needs review

I retested, and the tests are now passing.

TR’s picture

Status: Needs review » Reviewed & tested by the community

I confirmed the information about cache naming, see https://api.drupal.org/api/drupal/core%21core.api.php/group/cache/8.5.x. Also see core.services.yml for the way all other cache bins are named.

Patch still applies, tests pass, and this patch allows the rules cache to be programmatically cleared.

  • fago committed afff2bd on 8.x-3.x authored by Devin Carlson
    Issue #2852231 by Devin Carlson, TR: Cache bin doesn't follow the naming...
fago’s picture

Status: Reviewed & tested by the community » Fixed

thx, committed and pushed.

Status: Fixed » Closed (fixed)

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