Problem/Motivation

If you install the Symfony ExpressionLanguage component:

composer require symfony/expression-language

Then the tests will fail:

There were 2 failures:

1) Drupal\Tests\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumperTest::testGetServiceDefinitionForExpression
Failed asserting that exception of type "ArgumentCountError" matches expected exception "\Symfony\Component\DependencyInjection\Exception\RuntimeException".

2) Drupal\Tests\Component\DependencyInjection\Dumper\PhpArrayDumperTest::testGetServiceDefinitionForExpression
Failed asserting that exception of type "ArgumentCountError" matches expected exception "\Symfony\Component\DependencyInjection\Exception\RuntimeException".

Proposed resolution

It looks like Symfony\Component\ExpressionLanguage\Expression has a constructor argument that our fake version in core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php does not. In Drupal\Tests\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumperTest::testGetServiceDefinitionForExpression() we are instnatiating a new instance of Symfony\Component\ExpressionLanguage\Expression without the constructor argument which is causing the exception.

Remaining tasks

  1. Write Test
  2. Write Patch

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidwbarratt created an issue. See original summary.

RedLucas25’s picture

I'm running into this problem too. I don't understand how anyone is able to get all the unit tests to run without this...

The Drupal.org website says that the test passes, but I don't understand how since Expression() definitely takes a parameter.

RedLucas25’s picture

I created a patch to fix this.

It's nothing special, but it does get rid of the failure under the context of this bug.

Also, I'm sorry I know it wasn't mentioned in the commit message but there was some improper whitespace I felt compelled to fix while I was in here.

RedLucas25’s picture

Assigned: Unassigned » RedLucas25
Status: Active » Needs review
borisson_’s picture

Version: 8.2.x-dev » 8.6.x-dev
Status: Needs review » Needs work

Also, I'm sorry I know it wasn't mentioned in the commit message but there was some improper whitespace I felt compelled to fix while I was in here.

We have dedicated issues to fix whitespace, so that should be removed from this patch.

Should we require symfony/expression-language as a dev-requirement to make sure that this doesn't regress in the future?

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

I tested this on Drupal 10.1.x, standard install.

$ dev composer require symfony/expression-language
$ ddev phpunit ./core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
phpunit -c core --debug -v --colors=always ./core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.13
Configuration: /var/www/html/core/phpunit.xml

--- trimmed --

Time: 00:00.032, Memory: 8.00 MB

OK (43 tests, 44 assertions)
$ 

git blames informs me that this was fixed in #2867871: Use of Symfony Expression Language "Expression" in OptimizedPhpArrayDumperTest doesn't match library

I will close this as a duplicate and move credit to that issue.