protected function createSuccess($value)
 {
     $callable = function () use($value) {
         return $value;
     };
     return Attempt::lazily($callable);
 }
示例#2
0
 protected function createFailure($exception)
 {
     $callable = function () use($exception) {
         throw $exception;
     };
     return Attempt::lazily($callable);
 }
示例#3
0
 /**
  * @test
  */
 public function it_does_not_call_the_callable_immediately()
 {
     $called = false;
     $attempt = Attempt::lazily(function () use(&$called) {
         $called = true;
     });
     $this->assertFalse($called);
 }