/** * @covers ::recoverWith */ public function test_recoverWith_return() { $subject = testNew(valueE()); $success = oppositeSubject::of(null); $failure = testSubject::of(valueE()); $swapWithSuccess = function () use($success) { return $success; }; $swapWithFailure = function () use($failure) { return $failure; }; self::assertSame($success, $subject->recoverWith($swapWithSuccess)); self::assertSame($failure, $subject->recoverWith($swapWithFailure)); }
public function getProvider() { return ['null' => [null], 'bool' => [false], 'Object' => [new \stdClass()], 'array' => [[]], 'integer' => [100], 'float' => [100.1], 'string' => ["Hi!"], 'Left hand side' => [oppositeSubject::of(new \Exception('Test Exception'))]]; }