Add unit test CI workflow and fix PHPUnit test suite issues#526
Merged
darknoon29 merged 9 commits intodevelopfrom Apr 3, 2026
Merged
Add unit test CI workflow and fix PHPUnit test suite issues#526darknoon29 merged 9 commits intodevelopfrom
darknoon29 merged 9 commits intodevelopfrom
Conversation
Agent-Logs-Url: https://github.com/OGSteam/ogspy/sessions/1028067d-5997-43ec-8a97-2af438dfcfe3 Co-authored-by: darknoon29 <13015521+darknoon29@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Run unit tests for the project
Add unit test CI workflow and fix PHPUnit 12 test suite issues
Mar 31, 2026
darknoon29
approved these changes
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a GitHub Actions workflow to run the unit test suite in CI and updates the PHPUnit/tooling setup to eliminate PHPUnit notices and a PHP 8.3 deprecation in the test run output.
Changes:
- Added a new CI workflow to run PHPUnit with coverage on pushes/PRs to
develop/master. - Updated unit tests to avoid PHPUnit mock “no expectations” notices (logger as stub + targeted
AllowMockObjectsWithoutExpectations). - Updated PHPUnit configuration and removed deprecated
srand()usage ingenerate_key().
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/tests.yml |
Adds a dedicated unit test workflow running PHPUnit with Xdebug coverage. |
.github/workflows/release.yml |
Updates the release workflow PHP version to 8.4. |
tests/unit/PlayerModelTest.php |
Adjusts mocking/stubbing to reduce PHPUnit notices. |
tests/unit/UserModelTest.php |
Adjusts mocking/stubbing to reduce PHPUnit notices. |
phpunit.xml |
Updates PHPUnit schema and adds HTML coverage output. |
includes/functions.php |
Removes deprecated srand() call from key generation. |
composer.json |
Updates dev tooling (PHPUnit) and modifies PHP/platform requirements + test script. |
composer.lock |
Locks updated PHPUnit/tooling dependency tree. |
.gitignore |
Ignores generated HTML coverage directory. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
…verride, fix composer test script Agent-Logs-Url: https://github.com/OGSteam/ogspy/sessions/66a18cd8-3b19-4bcb-88a9-83448346d42a Co-authored-by: darknoon29 <13015521+darknoon29@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Add unit test CI workflow and fix PHPUnit 12 test suite issues
Add unit test CI workflow and fix PHPUnit test suite issues
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No CI workflow existed to run unit tests. The test suite also had 11 PHPUnit notices and a PHP 8.3 deprecation causing
OK, but there were issues!on every run.CI Workflow
.github/workflows/tests.yml: Runs PHPUnit on push/PR todevelop/masterwith PHP 8.4, Xdebug coverage, and Composer cachingFix PHPUnit Mock Notices (
PlayerModelTest,UserModelTest)PHPUnit 12 emits a notice when a
createMock()object has noexpects()call. Two root causes:createMock(Logger::class)tocreateStub(Logger::class)and updated property type toStub#[AllowMockObjectsWithoutExpectations]to those specific test methodsFix PHP 8.3 Deprecation (
includes/functions.php)srand((float)microtime() * 1000000)was deprecated in PHP 8.3 (float argument). The call was already dead code since the loop beneath it usesrandom_int(), which is CSPRNG and ignores thesrandseed — removed entirely.Fix
composer.jsonConsistency>=8.4.0back to>=8.1to match the installer's enforced minimumconfig.platform.phpremoved — the platform override that forced Composer to resolve packages as if PHP 8.4.x was the runtime is gone, eliminating the risk of a lockfile incompatible with real PHP 8.1 deploymentsphpunit/phpunitset to^12.0(PHPUnit 13 requires PHP ≥8.4.1, incompatible with the PHP 8.1 minimum once the platform override is removed)composer testscript fixed — replaced broken@putenv XDEBUG_MODE=coveragewithXDEBUG_MODE=coverage php vendor/bin/phpunitResult:
OK (36 tests, 73 assertions)— clean, no notices or deprecations.Original prompt
Created from VS Code.