Skip to content

Commit

Permalink
Check that returned Option from apply is actually the same instance…
Browse files Browse the repository at this point in the history
… and value
  • Loading branch information
devnix committed Dec 29, 2023
1 parent 8c5deda commit 5fadf87
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/unit/Option/SomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,14 @@ public function testContains(): void
public function testApply(): void
{
$spy = new Ref(1);
$actual = 2;

$option = Option\some($actual);
$option->apply(static function (int $value) use ($spy) {
$option = Option\some(2);
$actual = $option->apply(static function (int $value) use ($spy) {
$spy->value += $value;
});

static::assertSame(3, $spy->value);
static::assertSame($actual, $option->unwrap());
static::assertSame($actual, $option);
}

public function testMap(): void
Expand Down

0 comments on commit 5fadf87

Please sign in to comment.