isSucceeded()); static::assertTrue($wrapper->isFailed()); static::assertSame($exception, $wrapper->getException()); $this->expectExceptionObject($exception); $wrapper->getResult(); } public function testWrapResult(): void { $wrapper = Result\wrap(static function (): string { return 'foo'; }); static::assertTrue($wrapper->isSucceeded()); static::assertFalse($wrapper->isFailed()); static::assertSame('foo', $wrapper->getResult()); $this->expectException(InvariantViolationException::class); $this->expectExceptionMessage('No exception thrown'); $wrapper->getException(); } }