Skip to content

[TestFramework] Usages of TestCase::getTestResultObject are invalid since phpunit v10 #39463

Open
@stollr

Description

@stollr

Preconditions and environment

  • 2.4-develop branch

Steps to reproduce

Please look at #39427 (comment). The same code can be used to trigger a call to \PHPUnit\Framework\TestCase::getTestResultObject() (see here) which is invalid since phpunit v10.0.

@engcom-Hotel already reproduced this issue in the above mentioned issue (see this comment).

Expected result

I am expecting the output of the real reason of the issue, which is the usage of the non-existing scope key invalid_scope_key. The error message should look like this:

1) Exception in third-party event subscriber: Unable to apply fixture: Magento\Store\Test\Fixture\Store (store)
#0 /srv/htdocs/stollr/magento2/dev/tests/integration/testsuite/Magento/Ui/Component/Listing/Column/Store/OptionsTest.php(55): Magento\Ui\Component\Listing\Column\Store\OptionsTest->testStoreLabeleWithSingleQuote()

Caused By: Scope "ffoooooooo" does not exist.
# ...backtrace...

Actual result

But as this catch block calls an non-existing method, this error is triggered:

There was 1 PHPUnit test runner warning:

1) Exception in third-party event subscriber: Call to undefined method Magento\Ui\Component\Listing\Column\Store\OptionsTest::getTestResultObject()
#\0 /srv/htdocs/stollr/magento2/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php(81): Magento\TestFramework\Event\Transaction->_startTransaction()
#\1 /srv/htdocs/stollr/magento2/dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php(46): Magento\TestFramework\Event\Transaction->_processTransactionRequests()
#\2 [internal function]: Magento\TestFramework\Event\Transaction->startTest()
#\3 /srv/htdocs/stollr/magento2/dev/tests/integration/framework/Magento/TestFramework/EventManager.php(49): call_user_func_array()
#\4 /srv/htdocs/stollr/magento2/dev/tests/integration/framework/Magento/TestFramework/Event/PhpUnit.php(127): Magento\TestFramework\EventManager->fireEvent()
#\5 /srv/htdocs/stollr/magento2/dev/tests/integration/framework/Magento/TestFramework/Event/TestPreprationStartedSubscriber.php(34): Magento\TestFramework\Event\PhpUnit->startTest()
#\6 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Event/Dispatcher/DirectDispatcher.php(105): Magento\TestFramework\Event\TestPreprationStartedSubscriber->notify()
#\7 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Event/Dispatcher/DeferringDispatcher.php(47): PHPUnit\Event\DirectDispatcher->dispatch()
#\8 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Event/Emitter/DispatchingEmitter.php(313): PHPUnit\Event\DeferringDispatcher->dispatch()
#\9 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php(651): PHPUnit\Event\DispatchingEmitter->testPreparationStarted()
#\10 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Framework/TestRunner.php(106): PHPUnit\Framework\TestCase->runBare()
#\11 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Framework/TestCase.php(517): PHPUnit\Framework\TestRunner->run()
#\12 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/Framework/TestSuite.php(374): PHPUnit\Framework\TestCase->run()
#\13 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#\14 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/src/TextUI/Application.php(203): PHPUnit\TextUI\TestRunner->run()
#\15 /srv/htdocs/stollr/magento2/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run()
#\16 /srv/htdocs/stollr/magento2/vendor/bin/phpunit(122): include('...')
#\17 {main}

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Test frameworkComponent: Framework/TestFrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: ready for devReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions