tests 継承するクラスを Common_TestCase に統一#1403
Conversation
📝 WalkthroughWalkthrough複数のテストファイルで基底クラスを PHPUnit の TestCase 系から Changesテスト基底クラスの統一
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
#1402 投稿時点では、もっと該当があると思い込んでいたが、実際には局所的な使用状況だった。 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1403 +/- ##
==========================================
+ Coverage 55.88% 56.20% +0.31%
==========================================
Files 87 87
Lines 11090 11090
==========================================
+ Hits 6198 6233 +35
+ Misses 4892 4857 -35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7631399 の対応を差し戻した。
could not find MDB2 instance #1401There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/class/batch/SC_Batch_Update_parseDistInfoTest.php (1)
6-38: ⚡ Quick win
Common_TestCaseへの変更がこのクラスでは実質効いていません。
@backupGlobals disabledのまま、setUp()/tearDown()でもparent::setUp()/parent::tearDown()を呼んでいないので、Common_TestCase側のトランザクション管理や MDB2 初期化はこのテストでは使われません。ここは親ライフサイクルを呼ぶか、DB 非依存テストとしてPHPUnit\Framework\TestCaseのままに戻したほうが変更意図と一致します。Based on learnings, pure unit tests that don't require database access should extend
PHPUnit\Framework\TestCaseinstead ofCommon_TestCaseto avoid environment-dependent setup and skipped tests.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/class/batch/SC_Batch_Update_parseDistInfoTest.php` around lines 6 - 38, The test class SC_Batch_Update_parseDistInfoTest either needs to call the parent lifecycle to use Common_TestCase's DB setup/teardown or be reverted to a pure unit test by changing its base class; update SC_Batch_Update_parseDistInfoTest so that setUp() and tearDown() call parent::setUp() and parent::tearDown() respectively (preserving the existing tmpDir logic), or if the test does not require DB/MDB2/transaction support, change the class to extend PHPUnit\Framework\TestCase instead of Common_TestCase to avoid relying on environment-dependent initialization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/class/batch/SC_Batch_Update_parseDistInfoTest.php`:
- Around line 6-38: The test class SC_Batch_Update_parseDistInfoTest either
needs to call the parent lifecycle to use Common_TestCase's DB setup/teardown or
be reverted to a pure unit test by changing its base class; update
SC_Batch_Update_parseDistInfoTest so that setUp() and tearDown() call
parent::setUp() and parent::tearDown() respectively (preserving the existing
tmpDir logic), or if the test does not require DB/MDB2/transaction support,
change the class to extend PHPUnit\Framework\TestCase instead of Common_TestCase
to avoid relying on environment-dependent initialization.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e68a2088-1866-459a-b71e-ca3ce25a1893
📒 Files selected for processing (3)
tests/class/SC_Query_Test.phptests/class/batch/SC_Batch_Update_parseDistInfoTest.phptests/class/modifier/Modifier_ScriptEscapeTest.php
✅ Files skipped from review due to trivial changes (1)
- tests/class/modifier/Modifier_ScriptEscapeTest.php
|
6795073 で3クラスを追加対応。 class Modifier_ScriptEscapeTest extends PHPUnit_Framework_TestCasecommit 24ced1b class SC_Batch_Update_parseDistInfoTest extends PHPUnit_Framework_TestCasecommit e4beafe #1341 class SC_Query_Test extends PHPUnit_Framework_TestCasecommit c13e750 |
fix #1401
#1402 (comment) の情報を基に、
extends \PHPUnit\Framework\TestCaseをextends Common_TestCaseに置換した。class Common_TestCase extends \PHPUnit\Framework\TestCaseなので、おそらく問題ないと見込んでいる。Summary by CodeRabbit