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

CommentFileSizeAuthor
#2 3205139.patch2.12 KBlongwave
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave created an issue. See original summary.

longwave’s picture

Status: Active » Needs review
FileSize
2.12 KB

In fact the existing test makes no sense:

    // Assert that the language tables weren't enabled.
    $this->assertTableCount('language', FALSE);

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.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Just cleanup of cruft then... thanks

  • catch committed 052fae4 on 9.2.x
    Issue #3205139 by longwave: Refactor away ModuleTestBase::...
catch’s picture

Status: Reviewed & tested by the community » Fixed

I 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!

Status: Fixed » Closed (fixed)

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