Replace multiple test methods in InfoParserUnitTest with 1 testInfoException and a dataprovider

Created on 13 March 2020, about 4 years ago
Updated 19 March 2024, 3 months ago

Problem/Motivation

In \Drupal\Tests\Core\Extension\InfoParserUnitTest we have at least 8 test methods that do that same thing

  1. Define a broken yml string
  2. Set 2 yml files to use this exact same string
  3. set an expected exception
  4. parse file 1 and make sure the exception is expected
  5. parse file 2 and make sure the exception is expected(only difference is file name)

Really these could all be 1 test method with dataprovider. Not all the current test methods do the double files but they would be better if they did.

Proposed resolution

Make a 1 test method testInfoException that has a dataprovider that covers all the cases by the current 8(or more) test methods.

This will the advantages of

  1. Being easier to add and review new test cases
  2. Make sure when we add test cases we don't forget anything like calling the parser 2x to make sure the static function doesn't affect the result(this happened originally)

Move the test cases used in these methods

  • testInfoParserMissingKeys
  • testMissingCoreVersionRequirement
  • testInfoParserMissingKey

to a new dataprovider providerInfoException used by new test method testInfoException. Then remove those methods.

Remaining tasks

Review, and Commit

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.2

Component
Update 

Last updated about 15 hours ago

  • Maintained by
  • 🇺🇸United States @tedbow
  • 🇺🇸United States @dww
Created by

🇺🇸United States tedbow Ithaca, NY, USA

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.69.0 2024