Strengthen console controller tests#20792
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20792 +/- ##
============================================
+ Coverage 80.43% 81.29% +0.85%
Complexity 11541 11541
============================================
Files 374 374
Lines 30232 30232
============================================
+ Hits 24317 24576 +259
+ Misses 5915 5656 -259 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThese changes add comprehensive test coverage for multiple Yii console controllers: a new test suite for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/framework/console/controllers/FixtureControllerSqliteTest.php`:
- Around line 170-181: The load action emits a grammatically incorrect error
string ("could not be found according given conditions"); update the message in
the load handler to match the unload message by inserting "to" so it reads
"could not be found according to given conditions". Locate the load action
(method name likely actionLoad or the load branch in FixtureController) and
replace the incorrect string literal with the corrected one to ensure
consistency with the unload message used in the test (which asserts "could not
be found according to given conditions").
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b03259d0-6bae-4da9-baa3-2a572d4bfbb9
📒 Files selected for processing (6)
tests/framework/console/controllers/CacheControllerSqliteTest.phptests/framework/console/controllers/FixtureControllerSqliteTest.phptests/framework/console/controllers/HelpControllerTest.phptests/framework/console/controllers/MigrateControllerTest.phptests/framework/console/controllers/MigrateControllerTestTrait.phptests/framework/console/controllers/ServeControllerTest.php


What does this PR do?
Adds tests for console controllers (CacheController, FixtureController, HelpController, ServeController, MigrateController, BaseMigrateController) to cover previously untested code paths.
Coverage
CacheController and FixtureController had existing tests that required MySQL. New test classes (
CacheControllerSqliteTest,FixtureControllerSqliteTest) test the same code without MySQL dependency, making them runnable in all CI environments.MigrateController/BaseMigrateController MSI unavailable due to pre-existing test failures (template PHPDoc mismatch in
testGenerateMigration, MySQL driver intestRefreshMigration#1).Uncovered lines:
getFixturesConfig()which always throws before returning empty)$type === nullaftertrim((string)$type))isAddressTaken()true path (needs real open port); 141 -passthru()inrunCommand()YII_ENV_PRODconstant branch; 681,683 -file_put_contentsfailure; 815-823,975,998 - methods overridden in MigrateControllerReflectionExceptionnever thrown, DI wraps it inInvalidConfigException)Changelog not required, because no source files changed.