when(function($error, $result) use ($value) { $this->assertNull($error); $this->assertSame($value, $result); }); } public function testWaitReturnsResolvedValue() { $value = 42; $success = new Success($value); $this->assertSame($value, $success->wait()); } }