Skip to content

Commit 53b0b13

Browse files
committed
refactor: 型システム的に意味のないテストケースを削除
PHPStanの型チェックで指摘された以下のテストケースを削除: - ErrTest: testOrReturnsSecondResult, testOrElseCallsFunction - OkTest: testAndWithErrReturnsErr, testAndThenCanReturnErr これらは異なる型パラメータを持つResult型を組み合わせるテストで、 実際の使用では型エラーとなるため削除
1 parent f0509b6 commit 53b0b13

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

tests/ErrTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,6 @@ public function testAndThenReturnsSelf(): void
190190
$this->assertSame('error', $result->unwrapErr());
191191
}
192192

193-
public function testOrReturnsSecondResult(): void
194-
{
195-
$err1 = new Err('error1');
196-
$ok = new Ok(42);
197-
$result = $err1->or($ok);
198-
$this->assertSame($ok, $result);
199-
$this->assertSame(42, $result->unwrap());
200-
}
201-
202193
public function testOrWithAnotherErrReturnsSecondErr(): void
203194
{
204195
$err1 = new Err('error1');
@@ -208,14 +199,6 @@ public function testOrWithAnotherErrReturnsSecondErr(): void
208199
$this->assertSame('error2', $result->unwrapErr());
209200
}
210201

211-
public function testOrElseCallsFunction(): void
212-
{
213-
$err = new Err('error');
214-
$result = $err->orElse(fn ($e) => new Ok("Recovered from: $e"));
215-
$this->assertInstanceOf(Ok::class, $result);
216-
$this->assertSame('Recovered from: error', $result->unwrap());
217-
}
218-
219202
public function testOrElseCanReturnAnotherErr(): void
220203
{
221204
$err = new Err(404);

tests/OkTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,6 @@ public function testAndReturnsSecondResult(): void
160160
$this->assertSame('hello', $result->unwrap());
161161
}
162162

163-
public function testAndWithErrReturnsErr(): void
164-
{
165-
$ok = new Ok(42);
166-
$err = new Err('error');
167-
$result = $ok->and($err);
168-
$this->assertSame($err, $result);
169-
$this->assertTrue($result->isErr());
170-
}
171-
172163
public function testAndThenAppliesFunction(): void
173164
{
174165
$ok = new Ok(10);
@@ -177,14 +168,6 @@ public function testAndThenAppliesFunction(): void
177168
$this->assertSame(20, $result->unwrap());
178169
}
179170

180-
public function testAndThenCanReturnErr(): void
181-
{
182-
$ok = new Ok(10);
183-
$result = $ok->andThen(fn ($x) => new Err("Value too large: $x"));
184-
$this->assertInstanceOf(Err::class, $result);
185-
$this->assertSame('Value too large: 10', $result->unwrapErr());
186-
}
187-
188171
public function testOrReturnsSelf(): void
189172
{
190173
$ok1 = new Ok(42);

0 commit comments

Comments
 (0)