Problem/Motivation

See tests results: https://www.drupal.org/pift-ci-job/2486537

1) Drupal\Tests\ohdear_integration\Functional\OhdearIntegrationEndpointTest::testApiResponseData
Exception: Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
Drupal\Component\Utility\Html::escape()() (Line: 424)
fail: [run-tests.sh check] Line 0 of :
FATAL Drupal\Tests\ohdear_integration\Functional\OhdearIntegrationEndpointTest: test runner returned a non-zero error code (2).

Remaining tasks

Find issues and fix them.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

useernamee created an issue. See original summary.

useernamee’s picture

This test was not failing locally because monitoring module is patched with

#3277649: Deprication notice for htmlspecialchars with php 8.1
Source: https://www.drupal.org/files/issues/2022-05-06/monitoring-htmlspecialchars-deprecation-3277649-10.patch

useernamee’s picture

I'm out of ideas. Tests are passing locally:

$ ../../vendor/bin/phpunit ../modules/custom/ohdear_integration/tests/src/Functional/
PHPUnit 9.5.21 #StandWithUkraine

Testing /app/web/modules/custom/ohdear_integration/tests/src/Functional
.                                                                   1 / 1 (100%)

Time: 00:15.252, Memory: 12.00 MB

OK (1 test, 15 assertions)

With similar version:

PHP 8.1.3 — cli
Drupal 9.4.7

Will try to update phpunit locally and see if tests still pass.

useernamee’s picture

I wasn't able to reproduce the issue with phpunit 9.5.25.

I suspect the fail comes from #3277649: Deprecation notice for htmlspecialchars with php 8.1 but I'm not sure. Locally I have this patch applied.

useernamee’s picture

I've run tests locally with 8.x-1.11 tag of monitoring module and tests are passing. Which rules out my diagnose for test fails. So it looks like it is something that is related to phpunit configuration on drupal-ci that is running the tests.

Does anyone else have an idea how to approach this issue? (What could be the issue that tests are passing locally and failing on drupal-ci)

useernamee’s picture

Assigned: useernamee » Unassigned
useernamee’s picture

It looks like it is php version issue. Locally tests are passing on php8.1, not sure why they are not here, but I've tried a lot of things.

useernamee’s picture

Status: Active » Postponed (maintainer needs more info)

roderik made their first commit to this issue’s fork.

roderik’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

When I was checking the queue last week, I came across this issue and just pushed the 're-test' button with D10 + PHP8 (which is all we care about right now I guess?)

It succeeded.

Reviewed the code. Whether or not it fixes broken tests, the changes still look potentially useful. (Maybe it'll appease PHPStan when we start using it?)

So it can be merged into 1.x -- which is then mergeable into 2.x if you want. There are no conflicts.

What I pushed is just merging the up-to-date 1.x into the old MR. No actual changes.

ankitv18 made their first commit to this issue’s fork.

ankitv18’s picture

Cherry-picked commits from https://www.drupal.org/project/ohdear_integration/issues/3455573
Now pipelines for phpunit are passing ~~ RTBC++

useernamee’s picture

Looks good, thus merging.

  • useernamee committed 0abecfe0 on 1.x
    Issue #3312531 by useernamee, ankitv18: Automated tests are failing
    
useernamee’s picture

Status: Reviewed & tested by the community » Fixed
useernamee’s picture

Status: Fixed » Needs work

We'll need this fix on 2.x branch as well.

useernamee’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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