Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
metaregistrar committed Dec 21, 2018
1 parent ecccbb1 commit febe4dc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Protocols/EPP/eppRequests/eppTransferRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/eppCheckDomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions Tests/eppCreateContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]';
$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';
Expand Down
6 changes: 3 additions & 3 deletions Tests/eppCreateDnsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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());
}

Expand All @@ -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());
}
}
2 changes: 1 addition & 1 deletion Tests/eppCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit febe4dc

Please sign in to comment.