diff --git a/composer.json b/composer.json index d5b7a47..5be48c5 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,13 @@ }, "require": { "php": ">=7.1", - "react/http": "^1.5", - "react/promise": "^2.1 || ^1.2", + "react/http": "^1.11", + "react/promise": "^3.2 || ^2.1 || ^1.2", + "laminas/laminas-diactoros": "^3.5 || ^2.4", "ext-soap": "*" }, "require-dev": { - "clue/block-react": "^1.0", - "phpunit/phpunit": "^9.3 || ^7.5" + "react/async": "^4.3 || ^3.2", + "phpunit/phpunit": "^9.6 || ^7.5" } } diff --git a/src/Protocol/ClientEncoder.php b/src/Protocol/ClientEncoder.php index 8b065b9..ab63e8f 100644 --- a/src/Protocol/ClientEncoder.php +++ b/src/Protocol/ClientEncoder.php @@ -3,7 +3,8 @@ namespace Clue\React\Soap\Protocol; use Psr\Http\Message\RequestInterface; -use RingCentral\Psr7\Request; +use Laminas\Diactoros\Request; +use Laminas\Diactoros\StreamFactory; /** * @internal @@ -56,11 +57,13 @@ public function __doRequest($request, $location, $action, $version, $one_way = 0 ); } + $body = (new StreamFactory())->createStream((string)$request); + $this->request = new Request( - 'POST', (string)$location, - $headers, - (string)$request + 'POST', + $body, + $headers ); // do not actually block here, just pretend we're done... diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index f18af1d..b6ea770 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -2,12 +2,12 @@ namespace Clue\Tests\React\Soap; -use Clue\React\Block; +use React\Async; +use React\Http\Browser; use Clue\React\Soap\Client; use Clue\React\Soap\Proxy; use PHPUnit\Framework\TestCase; -use React\EventLoop\Loop; -use React\Http\Browser; + class BankResponse { @@ -55,7 +55,7 @@ public function testBlzService() $promise = $api->getBank(array('blz' => '12070000')); - $result = Block\await($promise, Loop::get()); + $result = Async\await($promise); $this->assertIsObject($result); $this->assertTrue(isset($result->details)); @@ -77,7 +77,7 @@ public function testBlzServiceWithClassmapReturnsExpectedType() $promise = $api->getBank(array('blz' => '12070000')); - $result = Block\await($promise, Loop::get()); + $result = Async\await($promise); $this->assertInstanceOf('Clue\Tests\React\Soap\BankResponse', $result); $this->assertTrue(isset($result->details)); @@ -97,7 +97,7 @@ public function testBlzServiceWithSoapV12() $promise = $api->getBank(array('blz' => '12070000')); - $result = Block\await($promise, Loop::get()); + $result = Async\await($promise); $this->assertIsObject($result); $this->assertTrue(isset($result->details)); @@ -117,7 +117,7 @@ public function testBlzServiceNonWsdlModeReturnedWithoutOuterResultStructure() // $promise = $api->getBank(new SoapParam('12070000', 'ns1:blz')); $promise = $api->getBank(new \SoapVar('12070000', XSD_STRING, null, null, 'blz', 'http://thomas-bayer.com/blz/')); - $result = Block\await($promise, Loop::get()); + $result = Async\await($promise); $this->assertIsObject($result); $this->assertFalse(isset($result->details)); @@ -158,7 +158,7 @@ public function testBlzServiceWithInvalidMethodRejectsWithSoapFault() $this->expectException(\SoapFault::class); $this->expectExceptionMessage('Function ("doesNotExist") is not a valid method for this service'); - Block\await($promise, Loop::get()); + Async\await($promise); } public function testCancelMethodRejectsWithRuntimeException() @@ -170,7 +170,7 @@ public function testCancelMethodRejectsWithRuntimeException() $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('cancelled'); - Block\await($promise, Loop::get()); + Async\await($promise); } public function testTimeoutRejectsWithRuntimeException() @@ -185,7 +185,7 @@ public function testTimeoutRejectsWithRuntimeException() $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('timed out'); - Block\await($promise, Loop::get()); + Async\await($promise); } public function testGetLocationForFunctionName() @@ -236,7 +236,7 @@ public function testWithLocationInvalidRejectsWithRuntimeException() $promise = $api->getBank(array('blz' => '12070000')); $this->expectException(\RuntimeException::class); - Block\await($promise, Loop::get()); + Async\await($promise); } public function testWithLocationRestoredToOriginalResolves() @@ -248,7 +248,7 @@ public function testWithLocationRestoredToOriginalResolves() $promise = $api->getBank(array('blz' => '12070000')); - $result = Block\await($promise, Loop::get()); + $result = Async\await($promise); $this->assertIsObject($result); } }