From febe4dc34aff8b5a377689ed80e35db83c60f614 Mon Sep 17 00:00:00 2001 From: Ewout de Graaf Date: Fri, 21 Dec 2018 13:29:55 +0100 Subject: [PATCH] Fixed tests --- Protocols/EPP/eppRequests/eppTransferRequest.php | 4 +++- Tests/eppCheckDomainTest.php | 2 +- Tests/eppCreateContactTest.php | 14 ++++++++++++++ Tests/eppCreateDnsTest.php | 6 +++--- Tests/eppCreateTest.php | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Protocols/EPP/eppRequests/eppTransferRequest.php b/Protocols/EPP/eppRequests/eppTransferRequest.php index 1ecc7823..35b9c1a8 100644 --- a/Protocols/EPP/eppRequests/eppTransferRequest.php +++ b/Protocols/EPP/eppRequests/eppTransferRequest.php @@ -177,7 +177,9 @@ public function setDomainRequest(eppDomain $domain) { } if (strlen($domain->getAuthorisationCode())) { $authinfo = $this->createElement('domain:authInfo'); - $authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode())); + $pw = $authinfo->appendChild($this->createElement('domain:pw')); + $pw->appendChild($this->createCDATASection($domain->getAuthorisationCode())); + //$authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode())); $this->domainobject->appendChild($authinfo); } $transfer->appendChild($this->domainobject); diff --git a/Tests/eppCheckDomainTest.php b/Tests/eppCheckDomainTest.php index 302a4902..92013a4d 100644 --- a/Tests/eppCheckDomainTest.php +++ b/Tests/eppCheckDomainTest.php @@ -65,7 +65,7 @@ public function testCheckDomainTaken() { * Expects a standard result for a taken domain name */ public function testCheckDomainReserved() { - $domainname = 'test'.$this->extension; + $domainname = 'nic'.$this->extension; $domain = new Metaregistrar\EPP\eppDomain($domainname); $this->assertInstanceOf('Metaregistrar\EPP\eppDomain',$domain); $check = new Metaregistrar\EPP\eppCheckRequest($domain); diff --git a/Tests/eppCreateContactTest.php b/Tests/eppCreateContactTest.php index 9ac32a99..ed98e289 100644 --- a/Tests/eppCreateContactTest.php +++ b/Tests/eppCreateContactTest.php @@ -3,6 +3,20 @@ class eppCreateContactTest extends eppTestCase { + public function testClientCreateContact() { + $name = 'jay'; + $city = 'Amsterdam'; + $country = 'NL'; + $organization = null; + $address= 'Pomme1'; + $postcode = '7905BA'; + $telephone = '+31.612413333'; + $email = 'jjay@gmail.com'; + $contactinfo = new Metaregistrar\EPP\eppContact(new Metaregistrar\EPP\EppContactPostalInfo($name, $city, $country, $organization, $address, null, $postcode, Metaregistrar\EPP\eppContact::TYPE_LOC), $email, $telephone); + $response = $this->conn->request(new \Metaregistrar\EPP\eppCreateContactRequest($contactinfo)); + $this->assertEquals('1000',$response->getResultCode()); + } + public function testCreateContact() { $name = 'Test name'; $city = 'Test city'; diff --git a/Tests/eppCreateDnsTest.php b/Tests/eppCreateDnsTest.php index 85d97112..fd5f249c 100644 --- a/Tests/eppCreateDnsTest.php +++ b/Tests/eppCreateDnsTest.php @@ -41,7 +41,7 @@ public function testCreateDnsWrongType() $records[] = ['type' => 'GARBAGE', 'name' => $domainname, 'content' => '127.0.0.1', 'ttl' => 3600]; $create = new Metaregistrar\EPP\metaregCreateDnsRequest($domain, $records); $response = $this->conn->writeandread($create); - $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2001: Command syntax error; Element \'{http://www.metaregistrar.com/epp/dns-ext-1.0}type\': [facet \'enumeration\'] The value \'GARBAGE\' is not an element of the set {\'A\', \'AAAA\', \'CNAME\', \'MX\', \'NS\', \'SOA\', \'SPF\', \'TXT\', \'SRV\', \'DNAME\', \'CAA\'}.'); + $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2001: Command syntax error; Element \'{http://www.metaregistrar.com/epp/dns-ext-1.0}type\': [facet \'enumeration\'] The value \'GARBAGE\' is not an element of the set {\'A\', \'AAAA\', \'ALIAS\', \'CNAME\', \'MX\', \'NS\', \'SOA\', \'SPF\', \'TXT\', \'SRV\', \'DNAME\', \'CAA\', \'TLSA\'}.'); $this->assertFalse($response->Success()); } @@ -56,7 +56,7 @@ public function testCreateDnsWrongIP() $records[] = ['type' => 'A', 'name' => $domainname, 'content' => 'GARBAGE', 'ttl' => 3600]; $create = new Metaregistrar\EPP\metaregCreateDnsRequest($domain, $records); $response = $this->conn->writeandread($create); - $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2004: Parameter value range error; Ip \'GARBAGE\' is not a valid IPV4 address for an A record'); + $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2004: Parameter value range error; Invalid IPV4 address "GARBAGE" for A record '.$domainname); $this->assertFalse($response->Success()); } @@ -70,7 +70,7 @@ public function testCreateDnsWrongDomain() { $records[] = ['type' => 'A', 'name' => 'wrongdomainname.frl', 'content' => '127.0.0.1', 'ttl' => 3600]; $create = new Metaregistrar\EPP\metaregCreateDnsRequest($domain, $records); $response = $this->conn->writeandread($create); - $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2004: Parameter value range error; Name field wrongdomainname.frl is not a valid name in an A type record'); + $this->setExpectedException('Metaregistrar\EPP\eppException', 'Error 2004: Parameter value range error; Invalid name for A record wrongdomainname.frl does not belong with '.$domainname); $this->assertFalse($response->Success()); } } \ No newline at end of file diff --git a/Tests/eppCreateTest.php b/Tests/eppCreateTest.php index d74cf948..acfec1ce 100644 --- a/Tests/eppCreateTest.php +++ b/Tests/eppCreateTest.php @@ -10,7 +10,7 @@ public function testCreateInterface() { $conn = Metaregistrar\EPP\eppConnection::create(dirname(__FILE__).'/testsetup.ini'); $this->assertInstanceOf('Metaregistrar\EPP\metaregEppConnection',$conn); /* @var $conn Metaregistrar\EPP\metaregEppConnection */ - $this->assertEquals($conn->getHostname(),'eppltest1.metaregistrar.com'); + $this->assertEquals($conn->getHostname(),'eppltest2.metaregistrar.com'); $this->assertEquals($conn->getPort(),7000); }