Problem/Motivation

This test uses a provider which is inherently slow for functional tests because each invocation installs Drupal. We can just use a foreach.

Numbers from my local machine/ddev:

Before:

../vendor/bin/phpunit modules/telephone/tests/src/Functional/TelephoneFieldTest.php
PHPUnit 10.5.26 by Sebastian Bergmann and contributors.

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

............                                                      12 / 12 (100%)

Time: 01:46.429, Memory: 4.00 MB

OK (12 tests, 121 assertions)

After:

../vendor/bin/phpunit modules/telephone/tests/src/Functional/TelephoneFieldTest.php
PHPUnit 10.5.26 by Sebastian Bergmann and contributors.

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

..                                                                  2 / 2 (100%)

Time: 00:19.843, Memory: 4.00 MB

OK (2 tests, 41 assertions)

1m46s down to 19s

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3462549

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

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

ankitv18’s picture

If thats the case then I would suggest to directly include array list within the testTelephoneFormatter function?
Any thoughts? @catch

ankitv18’s picture

Status: Needs review » Needs work
catch’s picture

Status: Needs work » Needs review

That makes sense - did the minimal code change to make sure it didn't introduce any failures, but now it doesn't, we can remove the extra method.

ankitv18’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @catch
Looks perfect after the refractor, pipelines are all executed properly ~~ hence marking this one RTBC.

  • nod_ committed 2328738a on 10.3.x
    Issue #3462549 by catch, ankitv18: Optimize TelephoneFieldTest
    
    (cherry...

  • nod_ committed 9e73b2b3 on 10.4.x
    Issue #3462549 by catch, ankitv18: Optimize TelephoneFieldTest
    
    (cherry...

  • nod_ committed 87b8c59a on 11.0.x
    Issue #3462549 by catch, ankitv18: Optimize TelephoneFieldTest
    
    (cherry...

  • nod_ committed c0e94e34 on 11.x
    Issue #3462549 by catch, ankitv18: Optimize TelephoneFieldTest
    
nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed c0e94e3446 to 11.x and 87b8c59a49 to 11.0.x and 9e73b2b33f to 10.4.x and 2328738ae7 to 10.3.x. Thanks!

Status: Fixed » Closed (fixed)

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