Page MenuHomeDevCentral

Upgrade tests to PHPUnit 12
ClosedPublic

Authored by dereckson on Sat, Oct 18, 13:08.

Details

Summary

Tests are now organized in a namespace Waystone\Workspaces\Tests,
each class, trait or interface in a dedicated file to follow PSR-4.

Coverage is defined by attributes.

Exceptions are directly handled by PHPUnit assert methods.

Tests can be run from:

  • the tests/ folder, as before
  • the repository root, with the new /phpunit.xml

A tests bootstrap script allows to load Composer dependencies
from the vendor/ directory at workspaces level or monorepo level.

Test Plan
  • Top-level: phpunit
  • Tests-level: (cd workspaces/tests && make test)

Diff Detail

Repository
rOBSIDIAN Obsidian Workspaces
Lint
No Lint Coverage
Unit
Tests Skipped
Branch
main
Build Status
Buildable 6026
Build 6310: arc lint + arc unit

Event Timeline

dereckson created this revision.

arc unit has a problem to load phpunit.xml it seems. If I remember well, it runs a test file directly, but in that case, PHPUnit can detect local configuration.

Workstation
$ phpunit workspaces/tests/Engines/Collection/SQLiteCollectionTest.php
Switching to Composer phpunit:
PHPUnit 12.5-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.13
Configuration: /Users/ssantoro/dev/nasqueron/obsidian/phpunit.xml

D...D.                                                              6 / 6 (100%)
[...]

Note the Configuration line to point to the actually loaded PHPUnit configuration file.

This revision is now accepted and ready to land.Sat, Oct 18, 13:33
This revision was automatically updated to reflect the committed changes.