Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Discovered via #3204764: PHPUnit assertions do not return a value, ModuleTestBase::assertTableCount() is only called once in core:
core/modules/system/tests/src/Functional/Module/DependencyTest.php
48: $this->assertTableCount('language', FALSE);
It is never called with the second argument being TRUE.
It is also unused in contrib: http://grep.xnddx.ru/search?text=assertTableCount&filename=
Steps to reproduce
Proposed resolution
Refactor the single caller to use tableExists() instead and remove the method.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3205139.patch | 2.12 KB | longwave |
Comments
Comment #2
longwaveIn fact the existing test makes no sense:
The language module doesn't create any database tables even when it is successfully installed. There is a later check that the config is correctly installed, so at this point we can check that the config hasn't been installed.
Comment #3
mondrakeJust cleanup of cruft then... thanks
Comment #5
catchI think given zero contrib modules use this, and the core usage is wrong, that it's OK to remove as dead code. If it turns out someone somewhere is using this, we could revert.
Committed 052fae4 and pushed to 9.2.x. Thanks!