Add PhpOption support to Option::of
This commit is contained in:
@@ -10,6 +10,7 @@ namespace Test;
|
||||
|
||||
use BitBadger\InspiredByFSharp\Option;
|
||||
use InvalidArgumentException;
|
||||
use PhpOption\{None, Some};
|
||||
use PHPUnit\Framework\Attributes\TestDox;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -64,6 +65,21 @@ class OptionTest extends TestCase
|
||||
$this->assertEquals('test', $it->get(), 'The value was not assigned correctly');
|
||||
}
|
||||
|
||||
#[TestDox('Of succeeds with PhpOption\Some')]
|
||||
public function testOfSucceedsWithPhpOptionSome(): void
|
||||
{
|
||||
$it = Option::of(Some::create('something'));
|
||||
$this->assertTrue(Option::isSome($it), 'A "Some" PhpOption should have created a "Some" option');
|
||||
$this->assertEquals('something', $it->get(), 'The value was not assigned correctly');
|
||||
}
|
||||
|
||||
#[TestDox('Of succeeds with PhpOption\None')]
|
||||
public function testOfSucceedsWithPhpOptionNone(): void
|
||||
{
|
||||
$it = Option::of(None::create());
|
||||
$this->assertTrue(Option::isNone($it), 'A "None" PhpOption should have created a "None" option');
|
||||
}
|
||||
|
||||
#[TestDox('IsNone succeeds with None')]
|
||||
public function testIsNoneSucceedsWithNone(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user