Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Hi, Just a minor change to allow configuration of the SOAPClient #382

Merged
merged 1 commit into from

3 participants

@alistairstead

Summary:

So that the SOAPClient is created with the appropriate options and additional parameter has been added to getMockFromWsdl and passed through to the MockObject_Generator. This is required if your create a mock method for __doRequest and pass a complex xml string. If you do not have the option to set client options it can result in different interpretation of objects and arrays by the SOAPClient.

@gigablah

What's the status of this one? Looking for a way to pass options to a mock client created with getMockFromWsdl(), surprised that it wasn't available.

@whatthejeff
Collaborator

I'm on it guys. Sorry for the delay :)

@whatthejeff
Collaborator

@alistairstead, GitHub is telling me this pull request cannot be automatically merged. Do you think you could bring your master branch up to date?

@alistairstead alistairstead Added $options array to TestCase::getMockFromWsdl
Summary:

So that the SOAPClient is created with the appropriate options and additional parameter has been added to getMockFromWsdl and passed through to the MockObject_Generator. This is required if your create a mock method for __doRequest and pass a complex xml string. If you do not have the option to set client options it can result in different interpretation of objects and arrays by the SOAPClient.
8c3ef88
@alistairstead

I've rebased my pull request against the upstream master. I hope you are now able to merge.

@whatthejeff whatthejeff merged commit 9c48bee into sebastianbergmann:master
@whatthejeff
Collaborator

Thanks, @alistairstead. Do you think you'd have time to add tests for this over at phpunit-mock-objects?

@whatthejeff
Collaborator

Also, would be nice to update the docs :)

@cspray cspray referenced this pull request from a commit
@whatthejeff whatthejeff Added the changelog entry for #382. c8ea390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2013
  1. @alistairstead

    Added $options array to TestCase::getMockFromWsdl

    alistairstead authored
    Summary:
    
    So that the SOAPClient is created with the appropriate options and additional parameter has been added to getMockFromWsdl and passed through to the MockObject_Generator. This is required if your create a mock method for __doRequest and pass a complex xml string. If you do not have the option to set client options it can result in different interpretation of objects and arrays by the SOAPClient.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 PHPUnit/Framework/TestCase.php
View
7 PHPUnit/Framework/TestCase.php
@@ -1432,10 +1432,11 @@ public function getMockForAbstractClass($originalClassName, array $arguments = a
* @param string $mockClassName
* @param array $methods
* @param boolean $callOriginalConstructor
+ * @param array $options An array of options passed to SOAPClient::_construct
* @return PHPUnit_Framework_MockObject_MockObject
* @since Method available since Release 3.4.0
*/
- protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = array(), $callOriginalConstructor = TRUE)
+ protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = array(), $callOriginalConstructor = TRUE, array $options = array())
{
if ($originalClassName === '') {
$originalClassName = str_replace(
@@ -1446,7 +1447,7 @@ protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClas
if (!class_exists($originalClassName)) {
eval(
$this->mockObjectGenerator->generateClassFromWsdl(
- $wsdlFile, $originalClassName, $methods
+ $wsdlFile, $originalClassName, $methods, $options
)
);
}
@@ -1454,7 +1455,7 @@ protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClas
return $this->getMock(
$originalClassName,
$methods,
- array('', array()),
+ array('', $options),
$mockClassName,
$callOriginalConstructor,
FALSE,
Something went wrong with that request. Please try again.