Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
- Write Test
- Write Patch
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal-fix-expression-test-2851771-12450853.patch | 1.46 KB | RedLucas25 |
Comments
Comment #2
RedLucas25 CreditAttribution: RedLucas25 commentedI'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.
Comment #3
RedLucas25 CreditAttribution: RedLucas25 as a volunteer and commentedI 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.
Comment #4
RedLucas25 CreditAttribution: RedLucas25 as a volunteer and commentedComment #5
borisson_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?Comment #15
quietone CreditAttribution: quietone at PreviousNext commentedI tested this on Drupal 10.1.x, standard install.
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.