Unit/System Tests Composer Dependency Changed PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar voronkovich
voronkovich
4 Mar 2025

Pull Request for Issue #36898.

This is a reopened version of PR #44894. I can't reopen the #44894 for technical reasons, sorry 😱

Summary of Changes

This PR adds an ability to configure Joomla using environment variables. To do this, the config provider has been changed to load all environment variables whose names start with JOOMLA_ (e.g. JOOMLA_DEBUG, JOOMLA_PASSWORD) and merge them into the config service.

Also, environment variables can be loaded from .env files, thankfully to symfony/dotenv.

Testing Instructions

  1. Create .env file in the site's root directory

  2. Set environment variables (inside the .env file):

    JOOMLA_OFFLINE=1
    JOOMLA_OFFLINE_MESSAGE='Joomla!'
  3. Reload site's home page and ensure that site is offline and the Joomla! message is shown

  4. Run the following command and ensure that the output is true:

    cli/joomla.php config:get offline
  5. Run the following command and ensure that the output is Joomla!:

    cli/joomla.php config:get offline_message

Actual result BEFORE applying this Pull Request

All should work.

Expected result AFTER applying this Pull Request

All should work.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org: joomla/Manual#432

  • No documentation changes for manual.joomla.org needed

Why?

The 12-factor app methodology recommends to store config in the environment.

Also, it makes Joomla more cloud-friendly and simplifies running it inside containers.

For example, using environment variables it's very easy to configure separate database for testing:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/Unit/bootstrap.php" colors="false">
        <testsuites>
                <testsuite name="Unit">
                        <directory suffix="Test.php">./tests/Unit</directory>
                </testsuite>
                <testsuite name="Integration">
                        <directory suffix="Test.php">./tests/Integration</directory>
                </testsuite>
        </testsuites>
        <php>
                <env name="JOOMLA_DBHOST" value="localhost" force="true"/>
                <env name="JOOMLA_DBNAME" value="joomla_test" force="true" />
                <env name="JOOMLA_DBUSER" value="joomla_test_user" force="true" />
                <env name="JOOMLA_DBPASSWORD" value="joomla_test_password" force="true" />
        </php>
</phpunit>
avatar voronkovich voronkovich - open - 4 Mar 2025
avatar voronkovich voronkovich - change - 4 Mar 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2025
Category Administration External Library Composer Change Installation Libraries Unit Tests
avatar voronkovich voronkovich - change - 4 Mar 2025
Labels Added: Unit/System Tests Composer Dependency Changed PR-6.0-dev
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2025
Category Administration External Library Composer Change Installation Libraries Unit Tests Administration Repository NPM Change JavaScript External Library Composer Change Installation Libraries Unit Tests
avatar voronkovich voronkovich - change - 4 Mar 2025
Labels Added: NPM Resource Changed
avatar joomla-cms-bot joomla-cms-bot - change - 4 Mar 2025
Category Administration External Library Composer Change Installation Libraries Unit Tests Repository NPM Change JavaScript Administration External Library Composer Change Installation Libraries Unit Tests
avatar voronkovich voronkovich - change - 5 Mar 2025
Labels Removed: NPM Resource Changed
avatar exlemor exlemor - test_item - 9 Mar 2025 - Tested successfully
avatar exlemor
exlemor - comment - 9 Mar 2025

I have tested this item ✅ successfully on 0f39e4e

I have test this PR successfully. Really cool @voronkovich.

( I don't understand however the logic of wanting to keep the installation folder after installation though, it seems like an unnecessary potential security risk )


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45070.

avatar voronkovich voronkovich - change - 11 Mar 2025
The description was changed
avatar voronkovich voronkovich - edited - 11 Mar 2025
avatar voronkovich voronkovich - change - 11 Mar 2025
The description was changed
avatar voronkovich voronkovich - edited - 11 Mar 2025
avatar voronkovich voronkovich - change - 11 Mar 2025
The description was changed
avatar voronkovich voronkovich - edited - 11 Mar 2025
avatar krishnaGandhi11 krishnaGandhi11 - test_item - 13 Mar 2025 - Tested successfully
avatar krishnaGandhi11
krishnaGandhi11 - comment - 13 Mar 2025

I have tested this item ✅ successfully on 0f39e4e

Tested the PR and it works as expected. Environment variable support is successfully integrated, and no issues were encountered. This enhancement improves flexibility in configuration.
@voronkovich Great work!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45070.

Add a Comment

Login with GitHub to post a comment