Files
AAU-Web/phpunit.xml
admin e75a233b36 ci: green test suite + GitHub Actions
Phase 0.10 — minimal CI. Stands the test suite up so the four feature
files written during Phase 0 actually run.

Test infrastructure:
  - phpunit.xml configured to use a separate aau_test MySQL database
    (NOT sqlite). The Phase 0.4b coupons.store_id-nullable migration
    uses raw ALTER TABLE MODIFY which sqlite cannot execute.
  - .env.testing checked in with localhost MySQL config and a fresh
    APP_KEY (NOT shared with production .env).
  - Local devs: create aau_test once, then
    `php artisan migrate --env=testing` and `php artisan test`.

GitHub Actions (.github/workflows/ci.yml):
  - PHP 8.1 + composer cache + MySQL 8.0 service container
  - Runs the same migrate/test commands as local.
  - Triggers on push to main / staging / claude and PRs against
    main / staging.

Test fixes that came out of bringing the suite up to green:
  - Three test files used Spatie role guard 'api' but User::$guard_name
    is 'web' — flipped to 'web'.
  - PricingServiceTest::makeProduct now creates the required Service
    + Variant FKs (products.service_id and variant_id are NOT NULL).
  - PricingServiceTest setUp seeds AppSetting.pick_to_delivery_gap.
  - OrderAuthorizationTest fixtures populate payment_status /
    payment_type (orders.payment_status is NOT NULL); use canonical
    enum values (Pending / Paid / Active / Monthly).
  - The expired-subscription test creates a Subscription parent before
    the StoreSubscription (subscription_id FK).
  - tests/Feature/ExampleTest now asserts the 302 redirect from the
    root path instead of an unrealistic 200.

Test result: 28 passed, 0 failed.

Phase 0 progress: 10/10. Phase 0.5 (Maya secret rotation) is the only
remaining item and is blocked on you rotating the live keys in the
Maya dashboard before I scrub them from the seeder + .env.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 12:42:58 +08:00

45 lines
1.7 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 suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<!--
Phase 0.10 / CI:
Tests run against a separate MySQL database (aau_test), not
SQLite, because our migrations use MySQL-specific raw ALTER
statements (e.g. coupons.store_id nullable change) that
SQLite cannot execute. Local developers must create aau_test
and run "php artisan migrate -env=testing" once. CI does
this in the workflow.
-->
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3306"/>
<env name="DB_DATABASE" value="aau_test"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_PASSWORD" value=""/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>