Skip to content

Commit 8f4bc92

Browse files
committed
Phase 5-1 サブ A レビュー指摘反映
- tests/Unit/Database/ConnectionTest.php: $this->fail() 省略ポリシーの コメントをクラス docblock 直前に移動。testCommitRequiresActiveTransaction / testRollbackRequiresActiveTransaction / testTransaction*-throws の 全体ポリシーとして読めるように整理(外部レビュー指摘) - composer.json: require-dev に ext-pdo_sqlite を追加。Unit テストが SQLite に依存しているため、ローカル composer install 時に拡張不足を 検出できるようにする(外部レビュー指摘) - composer.lock: 過去 commit で ext-pdo / ext-pdo_mysql を require に 追加した際に platform セクションが未更新だった分の追従を含む
1 parent 2dc7cd5 commit 8f4bc92

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"psr/simple-cache": "^3.0"
2626
},
2727
"require-dev": {
28+
"ext-pdo_sqlite": "*",
2829
"friendsofphp/php-cs-fixer": "^3.0",
2930
"infection/infection": "^0.32.6",
3031
"phpstan/phpstan": "^2.1",

composer.lock

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Unit/Database/ConnectionTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
use Sloop\Database\Exception\QueryException;
1818
use Sloop\Database\IsolationLevel;
1919

20+
/*
21+
* Policy: several tests below omit a trailing $this->fail() inside the try
22+
* block. When the code under test always throws on a given path, PHPStan
23+
* infers the call as never-return and flags the fail() as
24+
* deadCode.unreachable. coding-standards.md bans phpstan-ignore comments,
25+
* so we rely on PHPUnit's failOnRisky=true (a catch-less path with zero
26+
* assertions fails the test) to guard the "exception was not thrown" case.
27+
* Applies to testCommitRequiresActiveTransaction,
28+
* testRollbackRequiresActiveTransaction, and all testTransaction*-throws
29+
* tests.
30+
*/
2031
final class ConnectionTest extends TestCase
2132
{
2233
private PDO $pdo;
@@ -288,12 +299,6 @@ public function testTransactionPassesSelfToCallback(): void
288299
$this->assertSame($this->connection, $receiver->value);
289300
}
290301

291-
// In the transaction()-throws tests below we intentionally omit a trailing
292-
// $this->fail() in the try block: when the callback always throws, PHPStan
293-
// infers transaction() as never-return and flags the fail() as
294-
// deadCode.unreachable. coding-standards.md bans phpstan-ignore comments,
295-
// so we rely on PHPUnit's failOnRisky=true (zero assertions in a catch-less
296-
// path fails the test) to guard the "exception was not thrown" case.
297302
public function testTransactionRollsBackOnException(): void
298303
{
299304
try {

0 commit comments

Comments
 (0)