Пример #1
0
 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);
 }
Пример #2
0
 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);
 }