If Symfony ExpressionLanguage compoment is installed OptimizedPhpArrayDumperTest and PhpArrayDumperTest fail.

Created on 11 February 2017, almost 8 years ago
Updated 26 February 2023, over 1 year ago

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.

πŸ› Bug report
Status

Closed: duplicate

Version

10.1 ✨

Component
BaseΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States davidwbarratt

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    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 πŸ› Use of Symfony Expression Language "Expression" in OptimizedPhpArrayDumperTest doesn't match library Fixed

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

Production build 0.71.5 2024