Add test of token replacement

Created on 27 May 2025, 10 days ago

Problem/Motivation

Add a test to the TokenTest class to validate the custom token.

Steps to reproduce

N/A

Proposed resolution

Write a new test function to verify replacing the module's token.

Note that the test class should be created in 📌 Create kernel test class for test of token replacement Active before this change.

Remaining tasks

  1. Add a function to the TokenTest kernel test class.
  2. Assign the result of \Drupal::token() to a token service variable.
  3. Create a data array, containing the key, "verify_email", pointing to a child array, with the key "url", pointing to an example URL string.
  4. Create a variable containing a test string containing the [verify_email:url] token.
  5. Create a string variable containing the expected result, which should be the test string with the token replaced by the example URL above.
  6. Call the replace function of the token service, passing in the test string and the data array, and assigning the result to a variable.
  7. Add an assertion that the return value matches the expected result.

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Active

Version

1.1

Component

Code

Created by

🇮🇪Ireland lostcarpark

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024