diff --git a/tests/EPPConnectionTest.php b/tests/EPPConnectionTest.php new file mode 100644 index 0000000..35c7fc5 --- /dev/null +++ b/tests/EPPConnectionTest.php @@ -0,0 +1,73 @@ +'; + } + + public function writeXML(string $xml): void{ + assertEquals('',$xml); + } + + public function close(): bool{ + return true; + } + + public function isClosed(): bool{ + return true; + } + + public function open(): bool{ + return true; + } + }; + + $this->assertEquals('',$conn->readXML()); + $conn->writeXML(''); + + $this->assertTrue($conn->isClosed()); + $this->assertTrue($conn->open()); + $this->assertTrue($conn->isClosed()); + $this->assertTrue($conn->close()); + $this->assertTrue($conn->isClosed()); + } + + /** + * This test performs a real request to the test servers of SIDN. + * @return void + */ + public function testTCPConnection(){ + $registry = new SIDNTest; + + $conn = new EPPTCPConnection($registry); + $this->assertNotNull($conn); + + $conn->writeXML(''); + $this->assertNotNull($conn); + + $result = $conn->readXML(); + $this->assertIsString($result); + + $doc = EPPDocumentHelper::createEPPDocument(); + $doc->loadXML($result); + $this->assertInstanceOf(EPPEppElement::class,$doc->documentElement); + + $this->assertFalse($conn->isClosed()); + $this->assertTrue($conn->close()); + $this->assertTrue($conn->isClosed()); + } + +} \ No newline at end of file