Remove CacheTestBase and merge its functionality into ClearTest

Created on 2 April 2015, over 10 years ago
Updated 30 January 2023, over 2 years ago

Follow-up to #2389455: Clean-up system module test members - ensure property definition and use of camelCase naming convention β†’

From #2389455-76: Clean-up system module test members - ensure property definition and use of camelCase naming convention β†’ :

+++ b/core/modules/system/src/Tests/Cache/ClearTest.php
@@ -17,8 +17,8 @@
 class ClearTest extends CacheTestBase {

Let's get a followup to remove CacheTestBase and merge its functionality into ClearTest.

<!--Uncomment the relevant rows for the issue. -->
πŸ“Œ Task
Status

Needs work

Version

9.5

Component
SystemΒ  β†’

Last updated 5 minutes ago

No maintainer
Created by

πŸ‡¨πŸ‡¦Canada hussainweb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • First commit to issue fork.
  • Merge request !12544Resolve #2464383 "Cleartest" β†’ (Open) created by mstrelan
  • Pipeline finished with Success
    8 days ago
    Total: 376s
    #534857
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Rerolled to an MR, snuck in some property and param types and changed one of the public methods to protected. Wonder if this can be a kernel test but not sure it will cover everything that drupal_flush_all_caches does. Updated the issue summary with the standard template.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems like a good refactor to me, seems pretty straight forward.

  • πŸ‡¬πŸ‡§United Kingdom catch

    We would normally deprecate test base classes, but for me there's a grey area when modules have them because they're never really supposed to be used outside that module. However, I think it would be good to check in gitlab project search or the contrib grepping site whether there's any modules out there using this before we remove it.

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    There are 81 instances of CacheTestBase, but most of them look like clones of Drupal core.

    Excluding the path core/modules/system there is 1 instance and that is not a code reference but some kind of git log reference. Going to self-restore to RTBC based on this.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Thanks for checking.

    Looking at the test now, I don't think it should exist at all, it's a functional test that makes no http requests, looks like it was added in 2012 which when a lot of early test coverage was, and we didn't have real unit tests or kernel tests.

    Not sure we need any of this coverage, but we could maybe set a couple of cache items then check they're not there afterrwards in DrupalFlushAllCachesTest?

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Some other classes that previously extended CacheTestBase were replaced in #1637478: Add a PHP array cache backend β†’ , not sure why ClearTest wasn't replaced at the same time. We also have \Drupal\KernelTests\Core\Cache\GenericCacheBackendUnitTestBase::testDeleteAll but that doesn't necessarily cover drupal_flush_all_caches.

    DrupalFlushAllCachesTest has the @covers ::drupal_flush_all_caches annotation, so that's a good start. But it seems to only be testing that container.modules is updated.

    Not sure we need any of this coverage, but we could maybe set a couple of cache items then check they're not there afterrwards in DrupalFlushAllCachesTest?

    Yeah we could just move ClearTest::testFlushAllCaches in to DrupalFlushAllCachesTest. Probably that class should test everything that function does, like deleting asset files, twig caches etc. I guess those are all tested independently so it might be hard to find something useful to test.

    Unrelated to this issue, but this line in DrupalFlushAllCachesTest is useless now since that function has moved to OOP hooks.
    $this->assertFalse(function_exists('system_test_help'));

Production build 0.71.5 2024