Пример #1
0
 /**
  * @covers ::transform
  */
 public function test_transform_return()
 {
     $subject = testNew(valueE());
     $success = oppositeSubject::of(null);
     $failure = testNew(valueE());
     $switchToSuccess = function () use($success) {
         return $success;
     };
     $switchToFailure = function () use($failure) {
         return $failure;
     };
     self::assertSame($success, $subject->transform(doNotRun, $switchToSuccess));
     self::assertSame($failure, $subject->transform(doNotRun, $switchToFailure));
 }
Пример #2
0
 /** @covers ::flatMap */
 public function test_flatMap_return()
 {
     $lhsContents = testSubject::ofLeft(new \Exception());
     $rhsContents = testNew(1);
     self::assertSame($rhsContents, testSubject::of($rhsContents)->flatMap(identity));
     self::assertSame($lhsContents, testSubject::of($lhsContents)->flatMap(identity));
 }