Root cause: shell APP_ENV=development leaks into \$_SERVER via PHP's variables_order=EGPCS. phpunit.xml <env force> sets \$_ENV + putenv() but NOT \$_SERVER. Dotenv's RepositoryBuilder default adapter order puts ServerConstAdapter before EnvConstAdapter — so \$_SERVER wins. Consequences when env() returns 'development' during tests: - runningUnitTests() = false (checks app['env'] === 'testing') - PreventRequestForgery middleware doesn't bypass → POST/PUT → 419 (6 RegistrationTest failures + 1 UserTest profile update failure) - Filament/Livewire panel behaviour differs → fillForm validation fires on stale state (2 Flight resource tests) Fix: also force \$_SERVER['APP_ENV']='testing' via <server> directive. PHPUnit treats <server> + <env> as separate superglobals. Local: 460/9 → 471/0 (no other changes). CI unaffected (CI shell doesn't export APP_ENV so \$_SERVER was already empty).
45 lines
1.8 KiB
XML
45 lines
1.8 KiB
XML
<?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>
|
|
<testsuite name="Arch">
|
|
<file>tests/ArchTest.php</file>
|
|
<directory>tests/Arch</directory>
|
|
</testsuite>
|
|
<testsuite name="Components">
|
|
<directory suffix=".test.php">resources/views</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
<source>
|
|
<include>
|
|
<directory>app</directory>
|
|
</include>
|
|
</source>
|
|
<php>
|
|
<server name="APP_ENV" value="testing" force="true"/>
|
|
<env name="APP_ENV" value="testing" force="true"/>
|
|
<env name="APP_MAINTENANCE_DRIVER" value="file" force="true"/>
|
|
<env name="BCRYPT_ROUNDS" value="4" force="true"/>
|
|
<env name="BROADCAST_CONNECTION" value="null" force="true"/>
|
|
<env name="CACHE_STORE" value="array" force="true"/>
|
|
<env name="DB_CONNECTION" value="sqlite" force="true"/>
|
|
<env name="DB_DATABASE" value=":memory:" force="true"/>
|
|
<env name="DB_URL" value="" force="true"/>
|
|
<env name="MAIL_MAILER" value="array" force="true"/>
|
|
<env name="QUEUE_CONNECTION" value="sync" force="true"/>
|
|
<env name="SESSION_DRIVER" value="array" force="true"/>
|
|
<env name="PULSE_ENABLED" value="false" force="true"/>
|
|
<env name="TELESCOPE_ENABLED" value="false" force="true"/>
|
|
<env name="NIGHTWATCH_ENABLED" value="false" force="true"/>
|
|
</php>
|
|
</phpunit>
|