<?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>
            <exclude>tests/Feature/Dispatch/E2E</exclude>
        </testsuite>
        <!-- Full-system dispatch scenarios (E2E-7 … E2E-14, Test Groups 1–6), driven through the HTTP API. -->
        <testsuite name="E2E">
            <directory>tests/Feature/Dispatch/E2E</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>app</directory>
        </include>
    </source>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="APP_URL" value="http://localhost"/>
        <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"/>
        <!--
            The browser origins the suite asserts on, pinned so a developer adding their own
            dev origin to `.env` cannot turn the CORS tests red: the variable replaces the
            list rather than adding to it, so a local override silently drops the production
            dashboard — which is what these tests exist to catch in production, not here.
        -->
        <env name="ADMIN_ALLOWED_ORIGINS" value="http://localhost:3000,https://dashboard-captain.kapitano.shop" force="true"/>
        <!-- Tests that touch Redis use their own database, and flush it before each test. -->
        <env name="REDIS_DB" value="15" force="true"/>
        <!-- The same database for the cache connection. RecomputeRoutePlan keeps its uniqueness
             lock in the Redis cache store on purpose (every worker shares it), and that store
             otherwise points at REDIS_CACHE_DB — the developer's own cache, which a test run has
             no business writing locks into. -->
        <env name="REDIS_CACHE_DB" value="15" force="true"/>
        <!-- The routing tests answer from recorded fixtures. Forced off so that a key left in a
             developer's environment can never turn the suite into billed Google traffic; the
             handful of tests that call the real API skip unless this is deliberately set to 1. -->
        <env name="RUN_REAL_MAPS" value="0" force="true"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="FILESYSTEM_DISK" value="public"/>
        <!--
            Pinned so the suite can never reach the real Cloudflare R2 bucket.
            The media tests call Storage::fake('public'), which fakes that disk
            and nothing else, so a media disk of `r2` inherited from .env would
            send every uploaded fixture to production storage.

            An empty MEDIA_CLOUD_DISK also switches off background staging, so a
            test's upload is final the moment it returns and nothing depends on a
            queue worker having run.
        -->
        <env name="MEDIA_DISK" value="public"/>
        <env name="MEDIA_CONVERSIONS_DISK" value="public"/>
        <env name="MEDIA_CLOUD_DISK" value=""/>
        <env name="DB_DATABASE" value=":memory:"/>
        <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"/>
        <!-- The parallel-assignment test needs a real MySQL database shared by several PHP
             processes (in-memory SQLite is per process). CI variables override these. -->
        <env name="DB_CONCURRENCY_HOST" value="127.0.0.1" force="false"/>
        <env name="DB_CONCURRENCY_PORT" value="3306" force="false"/>
        <env name="DB_CONCURRENCY_DATABASE" value="kapitano_test" force="false"/>
        <env name="DB_CONCURRENCY_USERNAME" value="root" force="false"/>
        <env name="DB_CONCURRENCY_PASSWORD" value="" force="false"/>
    </php>
</phpunit>
