/** * When calling a method expecting to throw a SoapFault then return the expected message. */ public function testWhenCallingAMethodExpectingToThrowASoapFaultThenReturnTheExpectedMessage() { $client = new \SoapClient(APP_URL . '/wsdl', ['cache_wsdl' => WSDL_CACHE_NONE, 'location' => APP_URL]); $response = ''; try { $response = $client->pineapple(); static::fail('was expecting a SoapFault, got [' . serialize($response) . '] instead'); } catch (\SoapFault $e) { static::assertEquals('Function ("pineapple") is not a valid method for this service', $e->getMessage()); } }