<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
>
    <testsuites>
        <testsuite name="Unit">
            <directory>tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory>tests/Feature</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>app</directory>
        </include>
    </source>
    <php>
        <!--
            APP_ENV must be `testing` or CSRF verification stays on and every
            POST test fails with 419.

            This line alone is NOT enough when the app container sets APP_ENV
            in its own environment — which docker-compose.yml does. Neither a
            plain <env> nor force="true" overrides it (verified: the suite
            still ran as `development`). The runner therefore passes
            APP_ENV=testing as a real environment variable — see
            scripts/run_tests.sh and the phpunit job in .gitlab-ci.yml. This
            entry covers the case where nothing sets it at all.
        -->
        <env name="APP_ENV" value="testing"/>
        <env name="APP_MAINTENANCE_DRIVER" value="file"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="BROADCAST_CONNECTION" value="null"/>
        <env name="CACHE_STORE" value="array"/>
        <!--
            Feature tests run against real MySQL, not sqlite :memory:. The app
            leans on raw MySQL — CURDATE() in 11 files, DATE() in 15, plus
            CONCAT, GROUP_CONCAT, DATE_FORMAT, LAST_DAY and JSON_OBJECT — so on
            sqlite most controllers fail for dialect reasons that say nothing
            about whether the code is correct.

            Build the database first: `php artisan test:prepare-db`.

            These <env> entries do NOT override variables already present in the
            environment, so CI points DB_HOST at its own mysql service without
            editing this file. DB_NAME must stay a *_test name — prepare-db
            refuses to drop anything else.
        -->
        <env name="DB_CONNECTION" value="mysql"/>
        <env name="DB_HOST" value="db"/>
        <env name="DB_NAME" value="axioma_test"/>
        <env name="DB_URL" value=""/>
        <env name="MAIL_MAILER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="PULSE_ENABLED" value="false"/>
        <env name="TELESCOPE_ENABLED" value="false"/>
        <env name="NIGHTWATCH_ENABLED" value="false"/>
    </php>
</phpunit>
