Skip to content

Commit

Permalink
fix RequestTest with a Relay object passing to the RequestMessage class
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastix committed Jun 18, 2024
1 parent 75d3156 commit 4087ec5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use swentel\nostr\Relay\Relay;
use swentel\nostr\Subscription\Subscription;
use swentel\nostr\Filter\Filter;
use swentel\nostr\Message\RequestMessage;
Expand All @@ -27,13 +28,15 @@ public function testSendRequestToRelay()

$filters = [$filter];

$relay = new Relay($relayUrl);

// Mocking the WebSocket\Client
$mockClient = $this->getMockBuilder(Client::class)
->setConstructorArgs([$relayUrl])
->setConstructorArgs([$relay->getUrl()])
->getMock();

$requestMessage = new RequestMessage($subscriptionId, $filters);
$request = new Request($relayUrl, $requestMessage, $mockClient);
$request = new Request($relay, $requestMessage, $mockClient);

$result = $request->send();

Expand Down

0 comments on commit 4087ec5

Please sign in to comment.