Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Test rewrite for avoid test skip. Related zendframework/zendframework…
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Dec 14, 2013
1 parent 4ebc653 commit 7070c20
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions test/Client/DotNetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace ZendTest\Soap\Client;

use PHPUnit_Framework_TestCase;
use Zend\Soap\Client\Common;
use Zend\Soap\Client\DotNet as DotNetClient;
use ZendTest\Soap\TestAsset\MockCallUserFunc;

Expand Down Expand Up @@ -92,24 +93,36 @@ public function testCurlClientRequestIsDoneWhenUsingNtlmAuthentication()
*/
public function testDefaultSoapClientRequestIsDoneWhenNotUsingNtlmAuthentication()
{
if (version_compare(phpversion(), '5.5.6', '=') || version_compare(phpversion(), '5.5.7', '=')) {
$this->markTestSkipped('This test is incompatible with PHP 5.5.6-7 only, causes segfault.');
}

$soapClient = $this->getMock('Zend\Soap\Client\Common',
array('_doRequest'),
array(array($this->client, '_doRequest'),
null,
array('location' => 'http://unit/test',
'uri' => 'http://unit/test')));

MockCallUserFunc::$mock = true;
$unitTest = $this;
$soapClient = new Common(
function(Common $client, $request, $location, $action, $version, $oneWay = null) use ($unitTest) {
$unitTest->assertEquals('http://unit/test#TestMethod', $action);
$result = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'
. '<s:Body>';

$result .= '<TestMethodResponse xmlns="http://unit/test">'
. '<TestMethodResult>'
. '<TestMethodResult><dummy></dummy></TestMethodResult>'
. '</TestMethodResult>'
. '</TestMethodResponse>';

$result .= '</s:Body>'
. '</s:Envelope>';

return $result;
},
null,
array(
'location' => 'http://unit/test',
'uri' => 'http://unit/test'
)
);
$this->assertAttributeEquals(false, 'useNtlm', $this->client);
$this->client->setOptions(array('authentication' => 'ntlm',
'login' => 'username',
'password' => 'testpass'));
$this->client->setSoapClient($soapClient);
$this->client->TestMethod();

$this->assertSame('http://unit/test#TestMethod', MockCallUserFunc::$params[3]);

MockCallUserFunc::$mock = false;
$this->assertInstanceOf('stdClass', $this->client->TestMethod());
}

/**
Expand Down

0 comments on commit 7070c20

Please sign in to comment.