Create basic PHPUnit tests.

Created on 15 January 2025, 4 months ago

Problem/Motivation

The Environment Indicator module is a critical tool for distinguishing between development, staging, and production environments. Its visual cues reduce the risk of errors by ensuring users are always aware of the environment they are working in.

Despite its importance, the module currently lacks basic PHPUnit test coverage. This makes it challenging for maintainers and contributors to confidently add new features or address bug fixes, as they must manually verify expected behavior. Introducing automated tests would enhance the reliability of the module and ensure consistent behavior as the codebase evolves.

By developing basic PHPUnit tests, we can:

  • Verify core functionalities of the module.
  • Reduce the manual testing burden.
  • Provide maintainers with increased confidence when merging changes.
  • Lay the foundation for more comprehensive automated testing in the future.

Steps to reproduce

  1. Install the Environment Indicator module.
  2. Configure basic settings such as environment name and indicator color.
  3. Observe functionality in different scenarios:
    • With different themes like gin for example..
    • On authenticated and anonymous users' views.
    • With additional modules enabled like toolbar for example.
  4. Currently, there are no automated tests to verify these functionalities.

Proposed resolution

  • Develop basic PHPUnit tests to validate core functionalities of the module, starting with:
    • With the toolbar module disabled: test that the environment indicator renders the correct color and label based on configuration settings.
    • With the toolbar module disabled:Test that updating the configuration correctly changes the indicator’s color and label.
    • With the toolbar module disabled:Test that the module does not alter the visual output for anonymous users when the indicator is disabled for them.
    • Test that the environment indicator integrates correctly with standard and admin themes.
    • With the toolbar module and integration enabled: test that the environment indicator renders the correct color and label based on configuration settings.
    • With the toolbar module and integration enabled:Test that updating the configuration correctly changes the indicator’s color and label.
    • With the toolbar module and integration enabled:Test that the module does not alter the visual output for anonymous users when the indicator is disabled for them.
    • Test that the environment indicator integrates correctly with standard and admin themes.

Remaining tasks

  • Define test cases for the module’s basic functionality.
  • Write PHPUnit tests to verify:
    • Indicator color displays correctly based on configuration.
    • Configuration changes are respected.
    • Module initialization and integration with themes.
  • Review and commit the new test coverage.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

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

Merge Requests

Comments & Activities

  • Issue created by @trackleft2
  • Merge request !84Issue #3500006 Add basic PHPUnit tests → (Open) created by trackleft2
  • Pipeline finished with Failed
    3 months ago
    Total: 183s
    #431452
  • Pipeline finished with Failed
    3 months ago
    Total: 162s
    #431456
  • Pipeline finished with Failed
    3 months ago
    Total: 162s
    #431459
  • Pipeline finished with Failed
    3 months ago
    Total: 154s
    #431461
  • Pipeline finished with Failed
    3 months ago
    Total: 165s
    #431464
  • Pipeline finished with Failed
    3 months ago
    Total: 150s
    #431466
  • Pipeline finished with Failed
    3 months ago
    Total: 148s
    #431470
  • Pipeline finished with Failed
    3 months ago
    Total: 251s
    #431476
  • Pipeline finished with Failed
    3 months ago
    Total: 165s
    #431492
  • Pipeline finished with Failed
    3 months ago
    Total: 156s
    #431494
  • Pipeline finished with Failed
    3 months ago
    Total: 165s
    #431497
  • Pipeline finished with Canceled
    3 months ago
    Total: 77s
    #431498
  • Pipeline finished with Failed
    3 months ago
    Total: 167s
    #431499
  • Pipeline finished with Failed
    3 months ago
    Total: 172s
    #431500
  • Pipeline finished with Failed
    3 months ago
    Total: 396s
    #431503
  • Pipeline finished with Canceled
    3 months ago
    Total: 73s
    #431511
  • Pipeline finished with Failed
    3 months ago
    Total: 174s
    #431512
  • Pipeline finished with Success
    3 months ago
    Total: 180s
    #431515
  • Pipeline finished with Success
    3 months ago
    Total: 196s
    #431520
  • Pipeline finished with Failed
    3 months ago
    Total: 269s
    #431522
  • Pipeline finished with Failed
    3 months ago
    Total: 250s
    #431527
  • Pipeline finished with Success
    3 months ago
    #431564
  • Pipeline finished with Success
    3 months ago
    Total: 184s
    #431565
  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸
Production build 0.71.5 2024