-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc8a757
commit 70127af
Showing
46 changed files
with
2,008 additions
and
93 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace AfriCC\Tests\EPP\Extension\NASK\Check; | ||
|
||
use AfriCC\EPP\Extension\NASK\Check\Future as FutureCheck; | ||
use AfriCC\EPP\Extension\NASK\ObjectSpec; | ||
use Exception; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Future test case. | ||
*/ | ||
class FutureCheckTest extends TestCase | ||
{ | ||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
ObjectSpec::overwriteParent(); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
ObjectSpec::restoreParent(); | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* Tests Future->addFuture() | ||
*/ | ||
public function testAddFuture() | ||
{ | ||
$frame = new FutureCheck(); | ||
$frame->addFuture(TEST_DOMAIN); | ||
$frame->addFuture('przyklad1.pl'); | ||
$frame->addFuture('przyklad2.pl'); | ||
$frame->setClientTransactionId('ABC-12345'); | ||
|
||
$this->assertXmlStringEqualsXmlString( | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0"> | ||
<command> | ||
<check> | ||
<future:check | ||
xmlns:future="http://www.dns.pl/nask-epp-schema/future-2.0"> | ||
<future:name>' . TEST_DOMAIN . '</future:name> | ||
<future:name>przyklad1.pl</future:name> | ||
<future:name>przyklad2.pl</future:name> | ||
</future:check> | ||
</check> | ||
<clTRID>ABC-12345</clTRID> | ||
</command> | ||
</epp> | ||
', | ||
(string) $frame | ||
); | ||
} | ||
|
||
public function testDomainCheckFrameInvalidDomain() | ||
{ | ||
$frame = new FutureCheck(); | ||
|
||
if (method_exists($this, 'expectException')) { | ||
$this->expectException(Exception::class); | ||
$frame->addFuture('invalid_domain'); | ||
} else { | ||
try { | ||
$frame->addFuture('invalid_domain'); | ||
} catch (Exception $e) { | ||
$this->assertEquals('Exception', get_class($e)); | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
146 changes: 146 additions & 0 deletions
146
tests/EPP/Extension/NASK/Create/ContactCreateTest7x.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?php | ||
|
||
namespace AfriCC\Tests\EPP\Extension\NASK\Create; | ||
|
||
use AfriCC\EPP\Extension\NASK\Create\Contact; | ||
use AfriCC\EPP\Extension\NASK\ObjectSpec; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ContactCreateTest extends TestCase | ||
{ | ||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp():void | ||
{ | ||
parent::setUp(); | ||
ObjectSpec::overwriteParent(); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
ObjectSpec::restoreParent(); | ||
parent::tearDown(); | ||
} | ||
|
||
public function testContactCreateFrame() | ||
{ | ||
$frame = new Contact(); | ||
$frame->skipInt(); | ||
$frame->setId('sh8013'); | ||
$frame->setName('John Doe'); | ||
$frame->addStreet('123 Example Dr.'); | ||
$frame->addStreet('Suite 100'); | ||
$frame->setCity('Dulles'); | ||
$frame->setProvince('VA'); | ||
$frame->setPostalCode('20166-6503'); | ||
$frame->setCountryCode('US'); | ||
$frame->setVoice('+1.7035555555', 1234); | ||
$frame->setFax('+1.7035555556'); | ||
$frame->setEmail('jdoe@example.tld'); | ||
$auth = $frame->setAuthInfo(); | ||
$frame->setIndividual(true); | ||
|
||
$this->assertXmlStringEqualsXmlString( | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0"> | ||
<command> | ||
<create> | ||
<contact:create | ||
xmlns:contact="http://www.dns.pl/nask-epp-schema/contact-2.0"> | ||
<contact:id>sh8013</contact:id> | ||
<contact:postalInfo type="loc"> | ||
<contact:name>John Doe</contact:name> | ||
<contact:addr> | ||
<contact:street>123 Example Dr.</contact:street> | ||
<contact:street>Suite 100</contact:street> | ||
<contact:city>Dulles</contact:city> | ||
<contact:sp>VA</contact:sp> | ||
<contact:pc>20166-6503</contact:pc> | ||
<contact:cc>US</contact:cc> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:voice x="1234">+1.7035555555</contact:voice> | ||
<contact:fax>+1.7035555556</contact:fax> | ||
<contact:email>jdoe@example.tld</contact:email> | ||
<contact:authInfo> | ||
<contact:pw>' . $auth . '</contact:pw> | ||
</contact:authInfo> | ||
</contact:create> | ||
</create> | ||
<extension> | ||
<extcon:create | ||
xmlns:extcon="http://www.dns.pl/nask-epp-schema/extcon-2.0"> | ||
<extcon:individual>1</extcon:individual> | ||
</extcon:create> | ||
</extension> | ||
</command> | ||
</epp>', | ||
(string) $frame | ||
); | ||
} | ||
|
||
public function testContactCreateFrameOrganization() | ||
{ | ||
$frame = new Contact(); | ||
$frame->skipInt(); | ||
$frame->setId('sh8013'); | ||
$frame->setName('John Doe'); | ||
$frame->setOrganization('php-epp2'); | ||
$frame->addStreet('123 Example Dr.'); | ||
$frame->addStreet('Suite 100'); | ||
$frame->setCity('Dulles'); | ||
$frame->setProvince('VA'); | ||
$frame->setPostalCode('20166-6503'); | ||
$frame->setCountryCode('US'); | ||
$frame->setVoice('+1.7035555555', 1234); | ||
$frame->setFax('+1.7035555556'); | ||
$frame->setEmail('jdoe@example.tld'); | ||
$auth = $frame->setAuthInfo(); | ||
$frame->setIndividual(false); | ||
$frame->setConsentForPublishing(true); | ||
|
||
$this->assertXmlStringEqualsXmlString( | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0"> | ||
<command> | ||
<create> | ||
<contact:create | ||
xmlns:contact="http://www.dns.pl/nask-epp-schema/contact-2.0"> | ||
<contact:id>sh8013</contact:id> | ||
<contact:postalInfo type="loc"> | ||
<contact:name>John Doe</contact:name> | ||
<contact:org>php-epp2</contact:org> | ||
<contact:addr> | ||
<contact:street>123 Example Dr.</contact:street> | ||
<contact:street>Suite 100</contact:street> | ||
<contact:city>Dulles</contact:city> | ||
<contact:sp>VA</contact:sp> | ||
<contact:pc>20166-6503</contact:pc> | ||
<contact:cc>US</contact:cc> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:voice x="1234">+1.7035555555</contact:voice> | ||
<contact:fax>+1.7035555556</contact:fax> | ||
<contact:email>jdoe@example.tld</contact:email> | ||
<contact:authInfo> | ||
<contact:pw>' . $auth . '</contact:pw> | ||
</contact:authInfo> | ||
</contact:create> | ||
</create> | ||
<extension> | ||
<extcon:create | ||
xmlns:extcon="http://www.dns.pl/nask-epp-schema/extcon-2.0"> | ||
<extcon:individual>0</extcon:individual> | ||
<extcon:consentForPublishing>1</extcon:consentForPublishing> | ||
</extcon:create> | ||
</extension> | ||
</command> | ||
</epp>', | ||
(string) $frame | ||
); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace AfriCC\Tests\EPP\Extension\NASK\Create; | ||
|
||
use AfriCC\EPP\Extension\NASK\Create\Domain; | ||
use AfriCC\EPP\Extension\NASK\ObjectSpec; | ||
use Exception; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DomainCreateTest extends TestCase | ||
{ | ||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
ObjectSpec::overwriteParent(); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
ObjectSpec::restoreParent(); | ||
parent::tearDown(); | ||
} | ||
|
||
public function testDomainCreateFrame() | ||
{ | ||
$frame = new Domain(); | ||
$frame->setDomain(TEST_DOMAIN); | ||
$frame->setPeriod('1y'); | ||
$frame->addNs('ns1.' . TEST_DOMAIN); | ||
$frame->addHostObj('ns2.' . TEST_DOMAIN); | ||
$frame->setRegistrant('nsk1234'); | ||
$frame->setAdminContact('C002'); | ||
$frame->setTechContact('C003'); | ||
$frame->setBillingContact('C004'); | ||
$auth = $frame->setAuthInfo(); | ||
$frame->setBook(); | ||
|
||
$this->assertXmlStringEqualsXmlString( | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0"> | ||
<command> | ||
<create> | ||
<domain:create | ||
xmlns:domain="http://www.dns.pl/nask-epp-schema/domain-2.0"> | ||
<domain:name>' . TEST_DOMAIN . '</domain:name> | ||
<domain:period unit="y">1</domain:period> | ||
<domain:ns>ns1.' . TEST_DOMAIN . '</domain:ns> | ||
<domain:ns>ns2.' . TEST_DOMAIN . '</domain:ns> | ||
<domain:registrant>nsk1234</domain:registrant> | ||
<domain:authInfo> | ||
<domain:pw>' . $auth . '</domain:pw> | ||
</domain:authInfo> | ||
</domain:create> | ||
</create> | ||
<extension> | ||
<extdom:create | ||
xmlns:extdom="http://www.dns.pl/nask-epp-schema/extdom-2.0"> | ||
<extdom:book/> | ||
</extdom:create> | ||
</extension> | ||
</command> | ||
</epp>', | ||
(string) $frame | ||
); | ||
} | ||
|
||
public function testDomainCreateFrameInvalidHostObj() | ||
{ | ||
$frame = new Domain(); | ||
|
||
if (method_exists($this, 'expectException')) { | ||
$this->expectException(Exception::class); | ||
$frame->addHostObj('invalid_domain'); | ||
} else { | ||
try { | ||
$frame->addHostObj('invalid_domain'); | ||
} catch (Exception $e) { | ||
$this->assertEquals('Exception', get_class($e)); | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace AfriCC\Tests\EPP\Extension\NASK\Create; | ||
|
||
use AfriCC\EPP\Extension\NASK\Create\Future; | ||
use AfriCC\EPP\Extension\NASK\ObjectSpec; | ||
use Exception; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class FutureCreateTest extends TestCase | ||
{ | ||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
ObjectSpec::overwriteParent(); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown(): void | ||
{ | ||
ObjectSpec::restoreParent(); | ||
parent::tearDown(); | ||
} | ||
|
||
public function testFutureCreateFrame() | ||
{ | ||
$frame = new Future(); | ||
$frame->setFuture(TEST_DOMAIN); | ||
$frame->setPeriod('3y'); | ||
$frame->setRegistrant('nsk1234'); | ||
$auth = $frame->setAuthInfo(); | ||
|
||
$this->assertXmlStringEqualsXmlString( | ||
'<?xml version="1.0" encoding="UTF-8"?> | ||
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.0"> | ||
<command> | ||
<create> | ||
<future:create xmlns:future="http://www.dns.pl/nask-epp-schema/future-2.0"> | ||
<future:name>' . TEST_DOMAIN . '</future:name> | ||
<future:period unit="y">3</future:period> | ||
<future:registrant>nsk1234</future:registrant> | ||
<future:authInfo> | ||
<future:pw>' . $auth . '</future:pw> | ||
</future:authInfo> | ||
</future:create> | ||
</create> | ||
</command> | ||
</epp>', | ||
(string) $frame | ||
); | ||
} | ||
|
||
public function testFutureCreateFrameInvalidDomain() | ||
{ | ||
$frame = new Future(); | ||
|
||
if (method_exists($this, 'expectException')) { | ||
$this->expectException(Exception::class); | ||
$frame->setFuture('invalid_domain'); | ||
} else { | ||
try { | ||
$frame->setFuture('invalid_domain'); | ||
} catch (Exception $e) { | ||
$this->assertEquals('Exception', get_class($e)); | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.