Example #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));
 }
Example #2
0
 /** @covers ::flattenRight */
 function test_flattenRight_return()
 {
     $lhsContents = testSubject::ofLeft(new \Exception());
     $rhsContents = testNew(1);
     self::assertSame($lhsContents, testNew($lhsContents)->flattenRight());
     self::assertSame($rhsContents, testNew($rhsContents)->flattenRight());
 }