Fix PHPUnit tests on 8.x-7.x

Created on 26 August 2024, 8 months ago
Updated 29 August 2024, 8 months ago

Problem/Motivation

When running phpunit tests on elasticsearch_connector version 8.x-7.x the following error is thrown:
PHP Fatal error: Declaration of Drupal\Tests\elasticsearch_connector\Kernel\ClusterSchemaTest::setUp() must be compatible with Drupal\KernelTests\KernelTestBase::setUp(): void in /builds/calibrate/kidslife/kidslife/web/modules/contrib/elasticsearch_connector/tests/src/Kernel/ClusterSchemaTest.php on line 30

Steps to reproduce

Run phpunit tests on this version.

Proposed resolution

Solve by changing the function currently marked as public as protected.

🐛 Bug report
Status

Needs work

Version

7.0

Component

Code

Created by

🇧🇪Belgium kevinvb

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

Merge Requests

Comments & Activities

  • Issue created by @kevinvb
  • Status changed to Needs review 8 months ago
  • 🇧🇪Belgium kevinvb

    Modified function call in merge request.

  • First commit to issue fork.
  • Status changed to Needs work 8 months ago
  • 🇫🇮Finland sokru

    Thanks @kevinvb for working on this issue, it still needs more work to complete the PHPUnit tests on 8.x-7.x. In the past I have spent several days trying to fix the PHPUnit tests on 8.x-7.x branch, but its rather complicated. I'm happy to commit the MR once the PHPunit job passes.

    On general level, the current maintainers hope that people would swift to use 8.0.x branch, where the test coverage is better and CI pipelines are green.

  • Pipeline finished with Failed
    8 months ago
    Total: 230s
    #267191
  • Pipeline finished with Failed
    8 months ago
    Total: 166s
    #267214
  • 🇧🇪Belgium kevinvb

    At least with the latest state they run. It still alot of red but if you wish to run PHPunit tests it is possible.
    I know maintainer wants to push to the 8.0 branch and this branch is only security and bug fixes but if you have tests that all fail isn't that a bug?

  • 🇫🇮Finland sokru

    The tests have never passed on, not even during the DrupalCI times, so arguable if this issue should be on bug or task category. Here's the link for previous attempt to fix the tests https://git.drupalcode.org/project/elasticsearch_connector/-/merge_reque...

    And like I said if someone is able to make the tests pass, I'm happy to commit the MR.

Production build 0.71.5 2024