diff --git a/tests/RelaySetTest.php b/tests/RelaySetTest.php new file mode 100644 index 0000000..ddf8036 --- /dev/null +++ b/tests/RelaySetTest.php @@ -0,0 +1,44 @@ +generatePrivateKey(); + + $note = new Event(); + $note->setContent('Hello world'); + + $signer = new Sign(); + $signer->signEvent($note, $private_key); + + $relay1 = new Relay('wss://example1.com'); + $relay2 = new Relay('wss://example2.com'); + $relay3 = new Relay('wss://example3.com'); + + $relaySet = $this->createMock(RelaySet::class); + $relaySet->setRelays([$relay1, $relay2, $relay3]); + $relaySet->expects($this->once()) + ->method('send') + ->willReturn(new CommandResult(['OK', $note->getId(), true, ''])); + + $response = $relaySet->send(); + $this->assertTrue( + $response->isSuccess(), + ); + } +}