-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(tests): Refactor test imports for consistency and add support files. #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughCentralizes test support under Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. |
There was a problem hiding this 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 importImporting 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
📒 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.phptests/adapter/ResponseAdapterTest.phptests/http/UploadedFileTest.phptests/adapter/HeadersPsr7Test.phptests/http/ResponseTest.phptests/adapter/ServerParamsPsr7Test.phptests/http/stateless/ApplicationRoutingTest.phptests/http/stateless/ApplicationUploadedTest.phptests/http/stateless/ApplicationErrorHandlerTest.phptests/adapter/ServerRequestAdapterTest.phptests/emitter/SapiEmitterTest.phptests/creator/ServerRequestCreatorTest.phptests/http/ErrorHandlerTest.phptests/support/TestCase.phptests/http/stateless/ApplicationEventTest.phptests/http/stateless/ApplicationSessionTest.phptests/http/ServerExitCodeTest.phptests/http/stateless/ApplicationServerParamsTest.phptests/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.phptests/adapter/ResponseAdapterTest.phptests/http/UploadedFileTest.phptests/adapter/HeadersPsr7Test.phptests/http/ResponseTest.phptests/adapter/ServerParamsPsr7Test.phptests/http/stateless/ApplicationRoutingTest.phptests/http/stateless/ApplicationUploadedTest.phptests/adapter/ServerRequestAdapterTest.phptests/emitter/SapiEmitterTest.phptests/creator/ServerRequestCreatorTest.phptests/http/ErrorHandlerTest.phptests/support/TestCase.phptests/http/stateless/ApplicationEventTest.phptests/http/stateless/ApplicationSessionTest.phptests/http/ServerExitCodeTest.phptests/http/stateless/ApplicationServerParamsTest.phptests/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.phptests/adapter/HeadersPsr7Test.phptests/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.phptests/adapter/ResponseAdapterTest.phptests/http/ResponseTest.phptests/emitter/SapiEmitterTest.phptests/http/ErrorHandlerTest.phptests/support/TestCase.phptests/http/stateless/ApplicationEventTest.phptests/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.phptests/adapter/ResponseAdapterTest.phptests/http/UploadedFileTest.phptests/adapter/HeadersPsr7Test.phptests/http/ResponseTest.phptests/adapter/ServerParamsPsr7Test.phptests/http/stateless/ApplicationRoutingTest.phptests/creator/ServerRequestCreatorTest.phptests/http/ErrorHandlerTest.phptests/support/TestCase.phptests/http/stateless/ApplicationEventTest.phptests/http/stateless/ApplicationSessionTest.phptests/http/ServerExitCodeTest.phptests/http/stateless/ApplicationServerParamsTest.phptests/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.phptests/adapter/UploadedFilesPsr7Test.phptests/adapter/HeadersPsr7Test.phptests/http/ResponseTest.phptests/adapter/ServerParamsPsr7Test.phptests/http/stateless/ApplicationErrorHandlerTest.phptests/adapter/ServerRequestAdapterTest.phptests/creator/ServerRequestCreatorTest.phptests/http/stateless/ApplicationMemoryTest.phptests/support/TestCase.phptests/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.phptests/http/UploadedFileTest.phptests/adapter/UploadedFilesPsr7Test.phptests/creator/ServerRequestCreatorTest.phptests/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.phptests/adapter/UploadedFilesPsr7Test.phptests/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.phptests/adapter/UploadedFilesPsr7Test.phptests/http/stateless/ApplicationContentTypesTest.phptests/adapter/HeadersPsr7Test.phptests/http/ResponseTest.phptests/adapter/ServerParamsPsr7Test.phptests/http/stateless/ApplicationRoutingTest.phptests/http/ErrorHandlerTest.phptests/support/TestCase.phptests/http/stateless/ApplicationSessionTest.phptests/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.phptests/support/TestCase.phptests/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.phptests/support/TestCase.phptests/http/stateless/ApplicationCookieTest.phptests/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.phptests/support/TestCase.phptests/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.phpphpstan.neontests/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 fromtests/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 filetests/support/phpstan-config.phpexists and contains a valid PHPStan configuration.phpunit.xml.dist (1)
5-5: All references totests/bootstrap.phpremoved
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 importFactoryHelper and TestCase are correctly sourced from tests/support. Looks good.
tests/http/RequestTest.php (1)
16-16: Updated TestCase import is correctSwitch to tests/support\TestCase matches the refactor; no unused imports introduced.
tests/creator/UploadedFileCreatorTest.php (1)
12-12: LGTM: grouped import to tests/supportMatches project-wide pattern; both classes are used in this test.
tests/http/stateless/ApplicationErrorHandlerTest.php (1)
13-13: Grouped import aligns with support namespaceCorrectly 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
FactoryHelperandTestCasecome from the sametests\supportnamespace, 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\supportnamespace, 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__)todirname(__DIR__, 2)correctly accounts for TestCase being moved one level deeper:
- Old:
tests/TestCase.php→dirname(__DIR__)= project root- New:
tests/support/TestCase.php→dirname(__DIR__, 2)= project rootBoth
statelessApplication()andwebApplication()methods are updated consistently.Also applies to: 213-213
tests/emitter/SapiEmitterTest.php (1)
14-14: Consolidated support imports look goodMoving 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/helpersUsing 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 correctYii’s default FileTarget writes under runtime/logs; this aligns with convention and avoids earlier mismatch.
614-616: Updated @webroot expectation matches new support bootstrapExpecting tests/support as webroot is coherent with TestCase statelessApplication configuration and support/index.php scriptFile.
There was a problem hiding this 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/supportcomponent.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
📒 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
FactoryHelperandTestCasefrom 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.
Summary by CodeRabbit
Documentation
Tests
Chores
No user-facing functionality changes.