/** * @dataProvider exceptionProvider */ public function testCastsToProperException($code, $expectedException) { $requestWrapper = new GrpcRequestWrapper(); try { $requestWrapper->send(function () use($code) { throw new ApiException('message', $code); }, [[]], ['retries' => 0]); } catch (\Exception $ex) { $this->assertInstanceOf($expectedException, $ex); } }