public function testMultipleAttempt() { $this->soapClientMock->expects($this->at(0))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 502 Bad gateway\n\r")); $this->soapClientMock->expects($this->at(0))->method('__soapCall')->will($this->throwException(new \Exception('error', 502))); $this->soapClientMock->expects($this->at(1))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 503 Service unavailable Explained\n\r")); $this->soapClientMock->expects($this->at(1))->method('__soapCall')->will($this->throwException(new \Exception('error', 503))); $this->soapClientMock->expects($this->at(2))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 504 Gateway timeout Explained\n\r")); $this->soapClientMock->expects($this->at(2))->method('__soapCall')->will($this->throwException(new \Exception('error', 504))); $this->soapClientMock->expects($this->at(4))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 200 OK\n\r")); $this->soapClientMock->expects($this->at(4))->method('__soapCall'); $this->transport->expects($this->once())->method('getSoapClient')->will($this->returnValue($this->soapClientMock)); $this->settings->set('wsdl_url', 'http://localhost.not.exists/?wsdl'); $this->transport->init($this->transportEntity); $this->transport->call('test'); }