public function testifDefined() { $called = false; $self = $this; $this->assertNull(LazyOption::fromValue('foo')->ifDefined(function($v) use (&$called, $self) { $called = true; $self->assertEquals('foo', $v); })); $this->assertTrue($called); }
public function testForAll() { $called = false; $self = $this; $this->assertInstanceOf('PhpOption\\Some', LazyOption::fromValue('foo')->forAll(function ($v) use(&$called, $self) { $called = true; $self->assertEquals('foo', $v); })); $this->assertTrue($called); }