Ejemplo n.º 1
0
 public function testGetWithoutArgumentsAndConstructor()
 {
     $some = new \PhpOption\LazyOption(array($this->subject, 'execute'));
     $this->subject->expects($this->once())->method('execute')->will($this->returnValue(\PhpOption\Some::create('foo')));
     $this->assertEquals('foo', $some->get());
     $this->assertEquals('foo', $some->getOrElse(null));
     $this->assertEquals('foo', $some->getOrCall('does_not_exist'));
     $this->assertEquals('foo', $some->getOrThrow(new \RuntimeException('does_not_exist')));
     $this->assertFalse($some->isEmpty());
 }