Skip to content

Conversation

@terabytesoftw
Copy link
Member

@terabytesoftw terabytesoftw commented Oct 9, 2025

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

Summary by CodeRabbit

  • Documentation

    • Changelog updated to note test import consolidation and addition of test support files.
  • Tests

    • Standardized and consolidated test imports; moved and consolidated base test support and bootstrap/config for tests.
    • Adjusted test scaffolding, fixtures, and expected paths to match new test layout.
  • Chores

    • Expanded ignore rules for development artifacts and aligned static analysis and test runner bootstrap paths.

No user-facing functionality changes.

@terabytesoftw terabytesoftw added the bug Something isn't working label Oct 9, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 9, 2025

Walkthrough

Centralizes test support under tests/support, updates bootstrap and static analysis/phpunit config paths, consolidates many test imports into grouped yii2\extensions\psrbridge\tests\support\{FactoryHelper, TestCase} imports, adjusts ApplicationCoreTest paths/expectations, and updates repo metadata (.gitignore, CHANGELOG). No production code changes.

Changes

Cohort / File(s) Summary of changes
Repo metadata
\.gitignore, CHANGELOG.md
Added Copilot ignore entries to .gitignore; added CHANGELOG entry noting test import refactor and support files.
Tooling bootstrap/config
phpstan.neon, phpunit.xml.dist
Updated phpstan/phpunit bootstrap/config paths to point to tests/support/... (bootstrap and config path changes).
Test support files
tests/support/TestCase.php, tests/support/bootstrap.php
Moved TestCase namespace to ...\tests\support; adjusted application fixture basePath and removed/changed vendor/runtime entries; bootstrap now computes rootDir and requires autoload/Yii via {$rootDir}/vendor/....
Import consolidation (many tests)
tests/adapter/*, tests/creator/*, tests/emitter/*, tests/http/*, tests/http/stateless/*
Replaced separate FactoryHelper and TestCase imports with grouped imports yii2\extensions\psrbridge\tests\support\{FactoryHelper, TestCase} and updated TestCase import source. No behavioral changes.
ApplicationCoreTest adjustments
tests/http/stateless/ApplicationCoreTest.php
Added explicit function imports, changed test log path to /runtime/logs/flush-test.log, updated expected @webroot to include an extra support component and normalized path handling.

Sequence Diagram(s)

sequenceDiagram
  participant PHPUnit as PHPUnit runner
  participant Bootstrap as tests/support/bootstrap.php
  participant TestCase as tests/support/TestCase
  participant Test as individual test file

  Note over PHPUnit,Bootstrap: Test run starts
  PHPUnit->>Bootstrap: load bootstrap (tests/support/bootstrap.php)
  Bootstrap->>Bootstrap: compute rootDir, require vendor/autoload.php & yii.php
  PHPUnit->>Test: execute test file
  Test->>TestCase: extend/use support TestCase (from tests/support)
  TestCase->>Test: provide scaffolding (stateless/web app helpers)
  Note over Test,TestCase: Tests run with updated support paths
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

I hopped through code and mended trails,
Grouped imports snug in tidy veils.
Bootstrap smells of root and thyme,
Logs now nest in folders fine. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the core changes—refactoring test imports for consistency and adding support files—and aligns directly with the PR objectives and diff without extraneous details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-mini-169

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebca2c7 and 49865e6.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationCoreTest.php (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/http/stateless/ApplicationCoreTest.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: easy-coding-standard / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit-dev / PHP 8.6-ubuntu-latest
  • GitHub Check: phpunit-dev / PHP 8.5-ubuntu-latest
  • GitHub Check: phpstan / PHP 8.4-ubuntu-latest
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: linter / Super Linter
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: linter / Super Linter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (48aa822) to head (49865e6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #191   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       362       362           
===========================================
  Files             13        13           
  Lines            909       909           
===========================================
  Hits             909       909           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/http/stateless/ApplicationCoreTest.php (1)

32-32: Unnecessary constant import

Importing DIRECTORY_SEPARATOR isn’t needed; global constants are accessible without importing. Consider removing to reduce noise.

Apply this diff:

-use const DIRECTORY_SEPARATOR;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48aa822 and 3b19402.

📒 Files selected for processing (31)
  • .gitignore (1 hunks)
  • CHANGELOG.md (1 hunks)
  • phpstan.neon (2 hunks)
  • phpunit.xml.dist (1 hunks)
  • tests/adapter/CookiesPsr7Test.php (1 hunks)
  • tests/adapter/HeadersPsr7Test.php (1 hunks)
  • tests/adapter/ResponseAdapterTest.php (1 hunks)
  • tests/adapter/ServerParamsPsr7Test.php (1 hunks)
  • tests/adapter/ServerRequestAdapterTest.php (1 hunks)
  • tests/adapter/UploadedFilesPsr7Test.php (1 hunks)
  • tests/creator/ServerRequestCreatorTest.php (1 hunks)
  • tests/creator/UploadedFileCreatorTest.php (1 hunks)
  • tests/emitter/SapiEmitterTest.php (1 hunks)
  • tests/http/ErrorHandlerTest.php (1 hunks)
  • tests/http/RequestTest.php (1 hunks)
  • tests/http/ResponseTest.php (1 hunks)
  • tests/http/ServerExitCodeTest.php (1 hunks)
  • tests/http/UploadedFileTest.php (1 hunks)
  • tests/http/stateless/ApplicationAuthTest.php (1 hunks)
  • tests/http/stateless/ApplicationContentTypesTest.php (1 hunks)
  • tests/http/stateless/ApplicationCookieTest.php (1 hunks)
  • tests/http/stateless/ApplicationCoreTest.php (4 hunks)
  • tests/http/stateless/ApplicationErrorHandlerTest.php (1 hunks)
  • tests/http/stateless/ApplicationEventTest.php (1 hunks)
  • tests/http/stateless/ApplicationMemoryTest.php (1 hunks)
  • tests/http/stateless/ApplicationRoutingTest.php (1 hunks)
  • tests/http/stateless/ApplicationServerParamsTest.php (1 hunks)
  • tests/http/stateless/ApplicationSessionTest.php (1 hunks)
  • tests/http/stateless/ApplicationUploadedTest.php (1 hunks)
  • tests/support/TestCase.php (3 hunks)
  • tests/support/bootstrap.php (1 hunks)
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#149
File: tests/http/stateless/ApplicationCoreTest.php:24-27
Timestamp: 2025-08-25T16:08:54.379Z
Learning: In the yii2-extensions/psr-bridge project, avoid importing functions that are not actually used in the code, even if they might seem logically related to the functionality being tested.
📚 Learning: 2025-07-20T16:35:15.341Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1536-1552
Timestamp: 2025-07-20T16:35:15.341Z
Learning: In the yii2-extensions/psr-bridge project, the base TestCase class already handles $_SERVER cleanup in setUp() and tearDown() methods, so individual test methods that extend TestCase don't need manual $_SERVER restoration.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/ResponseAdapterTest.php
  • tests/http/UploadedFileTest.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/http/ResponseTest.php
  • tests/adapter/ServerParamsPsr7Test.php
  • tests/http/stateless/ApplicationRoutingTest.php
  • tests/http/stateless/ApplicationUploadedTest.php
  • tests/http/stateless/ApplicationErrorHandlerTest.php
  • tests/adapter/ServerRequestAdapterTest.php
  • tests/emitter/SapiEmitterTest.php
  • tests/creator/ServerRequestCreatorTest.php
  • tests/http/ErrorHandlerTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationEventTest.php
  • tests/http/stateless/ApplicationSessionTest.php
  • tests/http/ServerExitCodeTest.php
  • tests/http/stateless/ApplicationServerParamsTest.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-07-20T16:35:15.341Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1536-1552
Timestamp: 2025-07-20T16:35:15.341Z
Learning: In the yii2-extensions/psr-bridge project, the base TestCase class already handles $_SERVER cleanup in setUp() and tearDown() methods (lines 28 and 32), so individual test methods that extend TestCase don't need manual $_SERVER restoration.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/ResponseAdapterTest.php
  • tests/http/UploadedFileTest.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/http/ResponseTest.php
  • tests/adapter/ServerParamsPsr7Test.php
  • tests/http/stateless/ApplicationRoutingTest.php
  • tests/http/stateless/ApplicationUploadedTest.php
  • tests/adapter/ServerRequestAdapterTest.php
  • tests/emitter/SapiEmitterTest.php
  • tests/creator/ServerRequestCreatorTest.php
  • tests/http/ErrorHandlerTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationEventTest.php
  • tests/http/stateless/ApplicationSessionTest.php
  • tests/http/ServerExitCodeTest.php
  • tests/http/stateless/ApplicationServerParamsTest.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-06T22:52:05.608Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#64
File: tests/http/StatelessApplicationTest.php:1939-1967
Timestamp: 2025-08-06T22:52:05.608Z
Learning: In yii2-extensions/psr-bridge tests, when testing specific component methods like Request::resolve(), it's necessary to call $app->handle($request) first to initialize all application components before testing the method in isolation. This ensures proper component lifecycle initialization.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/adapter/ServerRequestAdapterTest.php
📚 Learning: 2025-08-26T15:37:52.160Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#155
File: tests/http/stateless/ApplicationMemoryTest.php:198-211
Timestamp: 2025-08-26T15:37:52.160Z
Learning: In yii2-extensions/psr-bridge, tests can use the TestSupport trait from php-forge/support package which provides an invokeMethod() helper for calling protected/private methods during testing, eliminating the need for custom reflection code.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/ResponseAdapterTest.php
  • tests/http/ResponseTest.php
  • tests/emitter/SapiEmitterTest.php
  • tests/http/ErrorHandlerTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationEventTest.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-07-20T16:33:57.495Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1564-1578
Timestamp: 2025-07-20T16:33:57.495Z
Learning: The TestCase class in yii2-extensions/psr-bridge automatically handles $_SERVER superglobal cleanup by saving its original state before each test and restoring it afterward in setUp() and tearDown() methods. Manual $_SERVER cleanup in individual test methods is unnecessary when extending this TestCase.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/ResponseAdapterTest.php
  • tests/http/UploadedFileTest.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/http/ResponseTest.php
  • tests/adapter/ServerParamsPsr7Test.php
  • tests/http/stateless/ApplicationRoutingTest.php
  • tests/creator/ServerRequestCreatorTest.php
  • tests/http/ErrorHandlerTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationEventTest.php
  • tests/http/stateless/ApplicationSessionTest.php
  • tests/http/ServerExitCodeTest.php
  • tests/http/stateless/ApplicationServerParamsTest.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-25T16:08:54.379Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#149
File: tests/http/stateless/ApplicationCoreTest.php:24-27
Timestamp: 2025-08-25T16:08:54.379Z
Learning: In the yii2-extensions/psr-bridge project, avoid importing functions that are not actually used in the code, even if they might seem logically related to the functionality being tested.

Applied to files:

  • tests/http/RequestTest.php
  • tests/adapter/UploadedFilesPsr7Test.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/http/ResponseTest.php
  • tests/adapter/ServerParamsPsr7Test.php
  • tests/http/stateless/ApplicationErrorHandlerTest.php
  • tests/adapter/ServerRequestAdapterTest.php
  • tests/creator/ServerRequestCreatorTest.php
  • tests/http/stateless/ApplicationMemoryTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-10T20:39:09.333Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#82
File: tests/adapter/UploadedFilesPsr7Test.php:197-248
Timestamp: 2025-08-10T20:39:09.333Z
Learning: In the yii2-extensions/psr-bridge project, the TestCase base class (tests/TestCase.php) automatically handles temporary file cleanup. The `createTmpFile()` method tracks files in `$this->tmpFiles[]`, and the `tearDown()` method calls `closeTmpFile()` to clean them up. Tests extending TestCase don't need manual file cleanup when using these methods.

Applied to files:

  • tests/adapter/ResponseAdapterTest.php
  • tests/http/UploadedFileTest.php
  • tests/adapter/UploadedFilesPsr7Test.php
  • tests/creator/ServerRequestCreatorTest.php
  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-28T22:08:51.812Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#160
File: tests/http/UploadedFileTest.php:122-179
Timestamp: 2025-08-28T22:08:51.812Z
Learning: In yii2-extensions/psr-bridge, when the PSR-7 adapter is set in UploadedFile, it indicates worker mode (like RoadRunner, Swoole), where $_FILES is not meaningful and should not be checked as a fallback. The PSR-7 adapter becomes the authoritative source for uploaded files in this mode.

Applied to files:

  • tests/http/UploadedFileTest.php
  • tests/adapter/UploadedFilesPsr7Test.php
  • tests/creator/ServerRequestCreatorTest.php
📚 Learning: 2025-08-24T11:52:50.563Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#141
File: tests/http/stateless/ApplicationRoutingTest.php:1-164
Timestamp: 2025-08-24T11:52:50.563Z
Learning: In yii2-extensions/psr-bridge, tests that manipulate PHP superglobals ($_POST, $_GET, $_SERVER) in the http group do not require process isolation and work fine with the current PHPUnit configuration.

Applied to files:

  • tests/http/UploadedFileTest.php
  • tests/adapter/UploadedFilesPsr7Test.php
  • tests/http/stateless/ApplicationContentTypesTest.php
  • tests/adapter/HeadersPsr7Test.php
  • tests/http/ResponseTest.php
  • tests/adapter/ServerParamsPsr7Test.php
  • tests/http/stateless/ApplicationRoutingTest.php
  • tests/http/ErrorHandlerTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationSessionTest.php
  • tests/http/stateless/ApplicationServerParamsTest.php
📚 Learning: 2025-08-08T15:24:06.085Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#71
File: tests/TestCase.php:23-27
Timestamp: 2025-08-08T15:24:06.085Z
Learning: In yii2-extensions/psr-bridge (tests/TestCase.php), maintainer preference: it’s acceptable to use random-looking strings for test-only constants like COOKIE_VALIDATION_KEY; no need to replace with an obviously non-secret value unless CI/secret scanners become problematic.

Applied to files:

  • tests/http/ResponseTest.php
  • tests/support/TestCase.php
  • tests/adapter/CookiesPsr7Test.php
📚 Learning: 2025-08-08T15:28:00.166Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#71
File: tests/adapter/ServerRequestAdapterTest.php:2215-2215
Timestamp: 2025-08-08T15:28:00.166Z
Learning: In yii2-extensions/psr-bridge tests, prefer using self::COOKIE_VALIDATION_KEY from tests/TestCase over hardcoded 'cookieValidationKey' strings to avoid secret scanners FP and improve maintainability.

Applied to files:

  • tests/http/ResponseTest.php
  • tests/support/TestCase.php
  • tests/http/stateless/ApplicationCookieTest.php
  • tests/adapter/CookiesPsr7Test.php
📚 Learning: 2025-08-08T15:28:00.166Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#71
File: tests/adapter/ServerRequestAdapterTest.php:2215-2215
Timestamp: 2025-08-08T15:28:00.166Z
Learning: In yii2-extensions/psr-bridge, tests extend tests/TestCase which defines a protected const COOKIE_VALIDATION_KEY. Test code should use self::COOKIE_VALIDATION_KEY instead of hardcoded cookieValidationKey literals.

Applied to files:

  • tests/http/ResponseTest.php
  • tests/support/TestCase.php
  • tests/adapter/CookiesPsr7Test.php
📚 Learning: 2025-08-03T16:24:09.241Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#53
File: src/http/ErrorHandler.php:258-272
Timestamp: 2025-08-03T16:24:09.241Z
Learning: In yii2-extensions/psr-bridge, the StatelessApplication creates a new Response instance for each request in the reset() method, then passes it to ErrorHandler::setResponse(). This means the template response is not shared across requests, so calling clear() on it in createErrorResponse() is safe and doesn't cause side effects.

Applied to files:

  • tests/http/stateless/ApplicationErrorHandlerTest.php
📚 Learning: 2025-08-29T15:39:21.600Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#161
File: tests/http/stateless/ApplicationEventTest.php:392-392
Timestamp: 2025-08-29T15:39:21.600Z
Learning: In yii2-extensions/psr-bridge tests, FactoryHelper::createRequest() can handle URIs both with and without leading slashes (e.g., 'site/index' and '/site/index' work equivalently). The leading slash is not required as the PSR-7 URI implementation and routing system normalize these paths. Both patterns are used throughout the test suite successfully.

Applied to files:

  • tests/adapter/ServerRequestAdapterTest.php
📚 Learning: 2025-08-10T20:39:09.333Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#82
File: tests/adapter/UploadedFilesPsr7Test.php:197-248
Timestamp: 2025-08-10T20:39:09.333Z
Learning: In the yii2-extensions/psr-bridge project, the TestCase base class configures the runtime path as `dirname(__DIR__) . '/runtime'` in the application configuration. Tests that need to save files to the runtime directory can rely on this pre-configured path.

Applied to files:

  • tests/support/TestCase.php
  • phpstan.neon
  • tests/http/stateless/ApplicationCoreTest.php
🧬 Code graph analysis (22)
tests/http/RequestTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/adapter/ResponseAdapterTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/UploadedFileTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/adapter/UploadedFilesPsr7Test.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationContentTypesTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/adapter/HeadersPsr7Test.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/adapter/ServerParamsPsr7Test.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationRoutingTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationUploadedTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/adapter/ServerRequestAdapterTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/emitter/SapiEmitterTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/creator/ServerRequestCreatorTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/ErrorHandlerTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/creator/UploadedFileCreatorTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationMemoryTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationCookieTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationEventTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationSessionTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/ServerExitCodeTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationAuthTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationServerParamsTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
tests/http/stateless/ApplicationCoreTest.php (1)
tests/support/TestCase.php (1)
  • TestCase (25-231)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: composer-require-checker / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: linter / Super Linter
  • GitHub Check: phpunit-dev / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit-dev / PHP 8.6-ubuntu-latest
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
🔇 Additional comments (35)
.gitignore (1)

4-5: LGTM!

The copilot ignore entries are appropriately added to keep the repository clean from Copilot-generated artifacts.

CHANGELOG.md (1)

6-6: LGTM!

The changelog entry accurately documents the test imports refactor and support files addition.

tests/adapter/HeadersPsr7Test.php (1)

9-9: LGTM!

The grouped import consolidates FactoryHelper and TestCase imports for consistency. Both symbols are actively used in the test class.

tests/http/stateless/ApplicationContentTypesTest.php (1)

9-9: LGTM!

The grouped import maintains consistency with the broader refactor. Both FactoryHelper and TestCase are used in this test class.

tests/http/UploadedFileTest.php (1)

9-9: LGTM!

The grouped import aligns with the repository-wide consistency refactor. Both symbols are properly utilized.

tests/support/bootstrap.php (1)

10-14: LGTM!

The rootDir-based path resolution is cleaner and more maintainable than relative paths. The calculation dirname(__DIR__, 2) correctly resolves to the project root from tests/support/bootstrap.php.

phpstan.neon (2)

6-6: LGTM!

The bootstrap path update is consistent with the phpunit.xml.dist change and the new test support structure.


17-17: phpstan-config.php presence confirmed
The file tests/support/phpstan-config.php exists and contains a valid PHPStan configuration.

phpunit.xml.dist (1)

5-5: All references to tests/bootstrap.php removed
No remaining occurrences found in the codebase.

tests/http/stateless/ApplicationAuthTest.php (1)

10-10: LGTM! Import consolidation improves consistency.

The grouped import follows modern PHP conventions and aligns with the PR's objective to standardize test imports across the suite.

tests/http/stateless/ApplicationRoutingTest.php (1)

9-9: LGTM! Consistent import refactoring.

The grouped import consolidation matches the pattern applied across the test suite and improves readability.

tests/adapter/UploadedFilesPsr7Test.php (1)

10-10: LGTM! Import consolidation follows established pattern.

The grouped import is consistent with the test suite refactoring and both classes are actively used in this file.

tests/http/stateless/ApplicationSessionTest.php (1)

10-10: LGTM! Consistent import pattern.

The import consolidation aligns with the broader test suite refactoring for improved consistency.

tests/http/stateless/ApplicationUploadedTest.php (1)

11-11: LGTM! Import refactoring consistent with test suite.

The grouped import follows the established pattern and both classes are used in the test file.

tests/adapter/CookiesPsr7Test.php (1)

12-12: LGTM! Grouped import improves consistency.

The import consolidation follows the test suite refactoring pattern and both classes are used.

tests/http/ServerExitCodeTest.php (1)

10-10: LGTM! TestCase namespace correctly updated.

The import reflects the migration of TestCase to the tests\support namespace, consistent with the broader test infrastructure refactoring.

tests/http/ErrorHandlerTest.php (1)

14-14: LGTM! TestCase import correctly updated.

The namespace update reflects the TestCase migration to tests\support, consistent with the test infrastructure refactoring across the suite.

tests/adapter/ServerRequestAdapterTest.php (1)

12-12: Consistent grouped import

FactoryHelper and TestCase are correctly sourced from tests/support. Looks good.

tests/http/RequestTest.php (1)

16-16: Updated TestCase import is correct

Switch to tests/support\TestCase matches the refactor; no unused imports introduced.

tests/creator/UploadedFileCreatorTest.php (1)

12-12: LGTM: grouped import to tests/support

Matches project-wide pattern; both classes are used in this test.

tests/http/stateless/ApplicationErrorHandlerTest.php (1)

13-13: Grouped import aligns with support namespace

Correctly sources FactoryHelper and TestCase from tests/support. No issues.

tests/creator/ServerRequestCreatorTest.php (1)

13-13: Import consolidation looks correct. Namespaces, class locations, and bootstrap configuration verified.

tests/http/stateless/ApplicationServerParamsTest.php (1)

10-10: LGTM! Import consolidation improves readability.

The grouped import syntax clearly shows that both FactoryHelper and TestCase come from the same tests\support namespace, improving code organization.

tests/http/ResponseTest.php (1)

15-15: LGTM! Consistent import style.

The grouped import aligns with the project-wide refactoring pattern.

tests/http/stateless/ApplicationCookieTest.php (1)

11-11: LGTM! Import consolidation applied correctly.

Consistent with the project-wide refactoring to use grouped imports.

tests/http/stateless/ApplicationEventTest.php (1)

11-11: LGTM! Grouped import applied consistently.

The import refactoring maintains consistency across the test suite.

tests/adapter/ServerParamsPsr7Test.php (1)

11-11: LGTM! Import style updated correctly.

Grouped import syntax improves code readability and maintains consistency.

tests/adapter/ResponseAdapterTest.php (1)

15-15: LGTM! Import consolidation is correct.

The grouped import syntax is applied consistently with other test files.

tests/http/stateless/ApplicationMemoryTest.php (1)

12-12: LGTM! Grouped import applied correctly.

Consistent with the project-wide import refactoring pattern.

tests/support/TestCase.php (2)

5-5: LGTM! Namespace updated to support directory.

The TestCase class is now properly located in the tests\support namespace, improving test file organization. All consuming test files have been updated to import from the new namespace.


148-148: LGTM! basePath correctly adjusted for new directory structure.

The change from dirname(__DIR__) to dirname(__DIR__, 2) correctly accounts for TestCase being moved one level deeper:

  • Old: tests/TestCase.phpdirname(__DIR__) = project root
  • New: tests/support/TestCase.phpdirname(__DIR__, 2) = project root

Both statelessApplication() and webApplication() methods are updated consistently.

Also applies to: 213-213

tests/emitter/SapiEmitterTest.php (1)

14-14: Consolidated support imports look good

Moving FactoryHelper and TestCase under tests\support via grouped import aligns with the new structure. No issues.

tests/http/stateless/ApplicationCoreTest.php (3)

18-19: Switched to tests\support base classes/helpers

Using yii2\extensions\psrbridge\tests\support{FactoryHelper, TestCase} is consistent with the refactor and fixes path mismatches.

Based on learnings


62-62: Log file path update to runtime/logs is correct

Yii’s default FileTarget writes under runtime/logs; this aligns with convention and avoids earlier mismatch.


614-616: Updated @webroot expectation matches new support bootstrap

Expecting tests/support as webroot is coherent with TestCase statelessApplication configuration and support/index.php scriptFile.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/http/stateless/ApplicationCoreTest.php (1)

612-615: Update the assertion message to reflect the actual path.

The updated expected value correctly reflects the relocation of support files to tests/support/. However, the assertion message on line 614 states "parent directory of the test directory", which is now less precise given the additional /support component.

Consider updating the assertion message to more accurately describe the path:

         self::assertSame(
             dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'support',
             Yii::getAlias('@webroot'),
-            "'@webroot' alias should be set to the parent directory of the test directory after handling a request.",
+            "'@webroot' alias should be set to the 'tests/support' directory after handling a request.",
         );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b19402 and 5d85359.

📒 Files selected for processing (1)
  • tests/http/stateless/ApplicationCoreTest.php (3 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#149
File: tests/http/stateless/ApplicationCoreTest.php:24-27
Timestamp: 2025-08-25T16:08:54.379Z
Learning: In the yii2-extensions/psr-bridge project, avoid importing functions that are not actually used in the code, even if they might seem logically related to the functionality being tested.
📚 Learning: 2025-07-20T16:35:15.341Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1536-1552
Timestamp: 2025-07-20T16:35:15.341Z
Learning: In the yii2-extensions/psr-bridge project, the base TestCase class already handles $_SERVER cleanup in setUp() and tearDown() methods, so individual test methods that extend TestCase don't need manual $_SERVER restoration.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-07-20T16:35:15.341Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1536-1552
Timestamp: 2025-07-20T16:35:15.341Z
Learning: In the yii2-extensions/psr-bridge project, the base TestCase class already handles $_SERVER cleanup in setUp() and tearDown() methods (lines 28 and 32), so individual test methods that extend TestCase don't need manual $_SERVER restoration.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-07-20T16:33:57.495Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#6
File: tests/http/RequestTest.php:1564-1578
Timestamp: 2025-07-20T16:33:57.495Z
Learning: The TestCase class in yii2-extensions/psr-bridge automatically handles $_SERVER superglobal cleanup by saving its original state before each test and restoring it afterward in setUp() and tearDown() methods. Manual $_SERVER cleanup in individual test methods is unnecessary when extending this TestCase.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-10T20:39:09.333Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#82
File: tests/adapter/UploadedFilesPsr7Test.php:197-248
Timestamp: 2025-08-10T20:39:09.333Z
Learning: In the yii2-extensions/psr-bridge project, the TestCase base class configures the runtime path as `dirname(__DIR__) . '/runtime'` in the application configuration. Tests that need to save files to the runtime directory can rely on this pre-configured path.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-10T20:39:09.333Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#82
File: tests/adapter/UploadedFilesPsr7Test.php:197-248
Timestamp: 2025-08-10T20:39:09.333Z
Learning: In the yii2-extensions/psr-bridge project, the TestCase base class (tests/TestCase.php) automatically handles temporary file cleanup. The `createTmpFile()` method tracks files in `$this->tmpFiles[]`, and the `tearDown()` method calls `closeTmpFile()` to clean them up. Tests extending TestCase don't need manual file cleanup when using these methods.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-26T15:37:52.160Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#155
File: tests/http/stateless/ApplicationMemoryTest.php:198-211
Timestamp: 2025-08-26T15:37:52.160Z
Learning: In yii2-extensions/psr-bridge, tests can use the TestSupport trait from php-forge/support package which provides an invokeMethod() helper for calling protected/private methods during testing, eliminating the need for custom reflection code.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
📚 Learning: 2025-08-25T16:08:54.379Z
Learnt from: terabytesoftw
PR: yii2-extensions/psr-bridge#149
File: tests/http/stateless/ApplicationCoreTest.php:24-27
Timestamp: 2025-08-25T16:08:54.379Z
Learning: In the yii2-extensions/psr-bridge project, avoid importing functions that are not actually used in the code, even if they might seem logically related to the functionality being tested.

Applied to files:

  • tests/http/stateless/ApplicationCoreTest.php
🧬 Code graph analysis (1)
tests/http/stateless/ApplicationCoreTest.php (2)
tests/support/FactoryHelper.php (1)
  • FactoryHelper (46-268)
tests/support/TestCase.php (1)
  • TestCase (25-231)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit-dev / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit-dev / PHP 8.6-ubuntu-latest
  • GitHub Check: linter / Super Linter
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: mutation / PHP 8.3-ubuntu-latest
  • GitHub Check: linter / Super Linter
🔇 Additional comments (2)
tests/http/stateless/ApplicationCoreTest.php (2)

18-18: LGTM!

The grouped import consolidates FactoryHelper and TestCase from the same namespace, improving readability and aligning with the PR's objective to refactor imports for consistency.


60-60: LGTM!

The log path standardization from /runtime/log/ to /runtime/logs/ is consistent with the broader refactoring mentioned in the AI summary and maintains internal consistency within the test.

@terabytesoftw terabytesoftw merged commit 3efb73e into main Oct 9, 2025
50 checks passed
@terabytesoftw terabytesoftw deleted the fix-mini-169 branch October 9, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants