Commands Overview
osdd:phpunit
Sync phpunit.xml with all layer test suites.
osdd:phpunit reads phpunit.xml, discovers all valid layers, and adds a <testsuite> entry for each layer that has a tests/ directory but is not already registered.
Requires the DOM PHP extension.
Usage
Terminal
php artisan osdd:phpunit
What It Does
- Reads your existing
phpunit.xml - Discovers all layers via
LayersCollection::fromConfig() - For each layer that has a
tests/directory and is not yet registered, injects a new<testsuite>block - Writes the updated
phpunit.xmlback to disk
Example Output
After running the command with two layers (functional/users and functional/orders), your phpunit.xml gains:
phpunit.xml
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<!-- Added by osdd:phpunit -->
<testsuite name="functional/users">
<directory suffix="Test.php">./functional/users/tests</directory>
</testsuite>
<testsuite name="functional/orders">
<directory suffix="Test.php">./functional/orders/tests</directory>
</testsuite>
</testsuites>
Running Layer Tests
Once registered, you can run a specific layer's tests:
Terminal
# Run a single layer's tests
./vendor/bin/phpunit --testsuite=functional/orders
# Run all tests including all layers
./vendor/bin/phpunit
Keeping It in Sync
Re-run osdd:phpunit any time you add a new layer with tests. The command is idempotent — already-registered suites are left unchanged.
Terminal
# Add a new layer
php artisan osdd:layer
# Add tests to the layer...
# Re-sync phpunit.xml
php artisan osdd:phpunit