[SoapRequest] Returns null if headers is empty

This commit is contained in:
Francis Besset 2011-09-23 10:23:59 +02:00
parent 9cec9c65c4
commit d29f0caa8d
2 changed files with 6 additions and 6 deletions

View File

@ -146,11 +146,11 @@ class SoapRequest
}
/**
* @return array
* @return array|null
*/
public function getHeaders()
{
return $this->headers;
return empty($this->headers) ? null : $this->headers;
}
/**
@ -194,4 +194,4 @@ class SoapRequest
return $this;
}
}
}

View File

@ -76,7 +76,7 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
{
$soapRequest = new SoapRequest();
$this->assertEquals(array(), $soapRequest->getHeaders());
$this->assertEquals(null, $soapRequest->getHeaders());
$header1 = new \SoapHeader('foobar', 'foo', 'bar');
$header2 = new \SoapHeader('barfoo', 'bar', 'foo');
@ -95,7 +95,7 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
$this->assertNull($soapRequest->getFunction());
$this->assertEquals(array(), $soapRequest->getArguments());
$this->assertEquals(array(), $soapRequest->getOptions());
$this->assertEquals(array(), $soapRequest->getHeaders());
$this->assertEquals(null, $soapRequest->getHeaders());
$arguments = array('bar' => 'foobar');
$options = array('soapaction' => 'foobar');
@ -110,4 +110,4 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($options, $soapRequest->getOptions());
$this->assertSame($headers, $soapRequest->getHeaders());
}
}
}