そのため、soap 呼び出しが認証に失敗したときにテストできる Behat シナリオをセットアップしようとしています。このステップをテストしてから、他のテスト ステップに移れるようにする必要があります。さて、認証なしでSOAPサービスへの呼び出しを具体的にテストしています(サービスにはHTTP認証が必要です)。これを行うと、PHP Fatal エラーが生成され、スクリプトが強制終了されます。
これまでのところ、「@」を使用してエラーを抑制し、error_reporting(0) を呼び出して、テストのその部分でのエラー報告をオフにしようとしました。しかし、それでもスクリプトは殺されます。これを回避する方法はありますか?
public function iConnectToASoapServiceAt($soapURL) {
$this->soapURL = $soapURL;
$errorReporting = error_reporting(); //Save the current error reporting level
error_reporting(0); //Turn off error reporting before we try this
try {
$this->client = @new Zend\Soap\Client($soapURL, $this->options);
$this->soapFunctions = $this->client->getFunctions();
}
catch (\Exception $e) {
#For testing when it fails we cannot actually throw an error here.
#throw new Exception("Error connecting to SOAP server.");
}
error_reporting($errorReporting);
}
エラーは次のとおりです。
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from
これを回避する方法はありますか?