Skip to content

Commit 741dcd3

Browse files
committed
implement rfc3915
1 parent 7550534 commit 741dcd3

File tree

11 files changed

+254
-26
lines changed

11 files changed

+254
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Features
4444
* SSL (+local-cert)
4545
* Xpath like setter to simplify the creation of complex XML structures
4646
* XML based responses for direct traversal via Xpath
47-
* [RFC 5730](http://tools.ietf.org/html/rfc5730), [RFC 5731](http://tools.ietf.org/html/rfc5731), [RFC 5732](http://tools.ietf.org/html/rfc5732), [RFC 5733](http://tools.ietf.org/html/rfc5733), [RFC 5734](http://tools.ietf.org/html/rfc5734)
47+
* [RFC 5730](http://tools.ietf.org/html/rfc5730), [RFC 5731](http://tools.ietf.org/html/rfc5731), [RFC 5732](http://tools.ietf.org/html/rfc5732), [RFC 5733](http://tools.ietf.org/html/rfc5733), [RFC 5734](http://tools.ietf.org/html/rfc5734) & [RFC 3915](http://tools.ietf.org/html/rfc3915)
4848

4949

5050
Install

src/AfriCC/EPP/Extension/NICMX/Restore/Domain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace AfriCC\EPP\Extension\NICMX\Restore;
1313

1414
use AfriCC\EPP\ExtensionInterface as Extension;
15-
use AfriCC\EPP\Frame\Command\Renew as Renew;
15+
use AfriCC\EPP\Frame\Command\Renew;
1616

1717
/**
1818
* @see https://www.registry.mx
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the php-epp2 library.
5+
*
6+
* (c) Gunter Grodotzki <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE file
9+
* that was distributed with this source code.
10+
*/
11+
12+
namespace AfriCC\EPP\Extension\Rgp\Update;
13+
14+
use AfriCC\EPP\ExtensionInterface as Extension;
15+
use AfriCC\EPP\Frame\Command\Update\Domain as DomainUpdate;
16+
17+
/**
18+
* @see https://tools.ietf.org/html/rfc3915#section-4.2.5
19+
*/
20+
class Domain extends DomainUpdate implements Extension
21+
{
22+
protected $extension = 'rgp';
23+
protected $extension_xmlns = 'urn:ietf:params:xml:ns:rgp-1.0';
24+
25+
public function changeDomain($domain)
26+
{
27+
$this->setDomain($domain);
28+
$this->set('domain:chg');
29+
}
30+
31+
public function addDomain($domain)
32+
{
33+
$this->setDomain($domain);
34+
$this->set('domain:add');
35+
}
36+
37+
public function removeDomain($domain)
38+
{
39+
$this->setDomain($domain);
40+
$this->set('domain:rem');
41+
}
42+
43+
public function restoreRequest()
44+
{
45+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'request\']');
46+
}
47+
48+
public function restoreReport()
49+
{
50+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']');
51+
}
52+
53+
public function setPreData($preData)
54+
{
55+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:preData', $preData);
56+
}
57+
58+
public function setPostData($postData)
59+
{
60+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:postData', $postData);
61+
}
62+
63+
public function setDelTime($delTime)
64+
{
65+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:delTime', $delTime);
66+
}
67+
68+
public function setResTime($resTime)
69+
{
70+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:resTime', $resTime);
71+
}
72+
73+
public function setResReason($resReason)
74+
{
75+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:resReason', $resReason);
76+
}
77+
78+
public function addStatement($statement)
79+
{
80+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:statement[]', $statement);
81+
}
82+
83+
public function setOther($other)
84+
{
85+
$this->set('//epp:epp/epp:command/epp:extension/rgp:update/rgp:restore[@op=\'report\']/rgp:report/rgp:other', $other);
86+
}
87+
88+
public function getExtensionNamespace()
89+
{
90+
return $this->extension_xmlns;
91+
}
92+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace AfriCC\EPP\Extension\NICMX\Restore;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
class DomainTest extends TestCase
8+
{
9+
public function testNicMxRestoreDomainFrame()
10+
{
11+
$frame = new Domain();
12+
$frame->setDomain(TEST_DOMAIN);
13+
14+
$this->assertXmlStringEqualsXmlString(
15+
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
16+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
17+
<command>
18+
<renew>
19+
<nicmx-domrst:restore xmlns:nicmx-domrst="http://www.nic.mx/nicmx-domrst-1.0">
20+
<nicmx-domrst:name>' . TEST_DOMAIN . '</nicmx-domrst:name>
21+
</nicmx-domrst:restore>
22+
</renew>
23+
</command>
24+
</epp>
25+
',
26+
(string) $frame
27+
);
28+
}
29+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
namespace AfriCC\EPP\Extension\Rgp\Update;
4+
5+
use PHPUnit\Framework\TestCase;
6+
7+
class DomainTest extends TestCase
8+
{
9+
public function testRestoreRequestFrame()
10+
{
11+
$frame = new Domain();
12+
$frame->changeDomain(TEST_DOMAIN);
13+
$frame->restoreRequest();
14+
15+
$this->assertXmlStringEqualsXmlString(
16+
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
17+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
18+
<command>
19+
<update>
20+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
21+
<domain:name>' . TEST_DOMAIN . '</domain:name>
22+
<domain:chg/>
23+
</domain:update>
24+
</update>
25+
<extension>
26+
<rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
27+
<rgp:restore op="request"/>
28+
</rgp:update>
29+
</extension>
30+
</command>
31+
</epp>
32+
',
33+
(string) $frame
34+
);
35+
}
36+
37+
public function testRestoreReportFrame()
38+
{
39+
$frame = new Domain();
40+
$frame->addDomain(TEST_DOMAIN);
41+
$frame->restoreReport();
42+
$frame->setPreData('Pre-delete registration data goes here. Both XML and free text are allowed.');
43+
$frame->setPostData('Post-restore registration data goes here. Both XML and free text are allowed.');
44+
$frame->setDelTime('2003-07-10T22:00:00.0Z');
45+
$frame->setResTime('2003-07-20T22:00:00.0Z');
46+
$frame->setResReason('Registrant error.');
47+
$frame->addStatement('This registrar has not restored the Registered Name in order to assume the rights to use or sell the Registered Name for itself or for anythird party.');
48+
$frame->addStatement('The information in this report is true to best of this registrar\'s knowledge, and this registrar acknowledges that intentionally supplying false information in this report shall constitute an incurable material breach of the Registry-Registrar Agreement.');
49+
$frame->setOther('Supporting information goes here.');
50+
51+
$this->assertXmlStringEqualsXmlString(
52+
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
53+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
54+
<command>
55+
<update>
56+
<domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
57+
<domain:name>' . TEST_DOMAIN . '</domain:name>
58+
<domain:add/>
59+
</domain:update>
60+
</update>
61+
<extension>
62+
<rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
63+
<rgp:restore op="report">
64+
<rgp:report>
65+
<rgp:preData>Pre-delete registration data goes here. Both XML and free text are allowed.</rgp:preData>
66+
<rgp:postData>Post-restore registration data goes here. Both XML and free text are allowed.</rgp:postData>
67+
<rgp:delTime>2003-07-10T22:00:00.0Z</rgp:delTime>
68+
<rgp:resTime>2003-07-20T22:00:00.0Z</rgp:resTime>
69+
<rgp:resReason>Registrant error.</rgp:resReason>
70+
<rgp:statement>This registrar has not restored the Registered Name in order to assume the rights to use or sell the Registered Name for itself or for anythird party.</rgp:statement>
71+
<rgp:statement>The information in this report is true to best of this registrar\'s knowledge, and this registrar acknowledges that intentionally supplying false information in this report shall constitute an incurable material breach of the Registry-Registrar Agreement.</rgp:statement>
72+
<rgp:other>Supporting information goes here.</rgp:other>
73+
</rgp:report>
74+
</rgp:restore>
75+
</rgp:update>
76+
</extension>
77+
</command>
78+
</epp>
79+
',
80+
(string) $frame
81+
);
82+
}
83+
}

tests/AfriCC/EPP/Test/Frame/Command/Create/ContactCreateTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testContactCreate()
2727
$frame->addDisclose('voice');
2828
$frame->addDisclose('email');
2929

30-
$this->assertXmlStringEqualsXmlString((string) $frame,
30+
$this->assertXmlStringEqualsXmlString(
3131
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3232
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
3333
<command>
@@ -71,7 +71,9 @@ public function testContactCreate()
7171
</contact:create>
7272
</create>
7373
</command>
74-
</epp>'
74+
</epp>
75+
',
76+
(string) $frame
7577
);
7678
}
7779

@@ -96,7 +98,7 @@ public function testContactCreateSkipInt()
9698
$frame->addDisclose('voice');
9799
$frame->addDisclose('email');
98100

99-
$this->assertXmlStringEqualsXmlString((string) $frame,
101+
$this->assertXmlStringEqualsXmlString(
100102
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
101103
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
102104
<command>
@@ -128,7 +130,9 @@ public function testContactCreateSkipInt()
128130
</contact:create>
129131
</create>
130132
</command>
131-
</epp>'
133+
</epp>
134+
',
135+
(string) $frame
132136
);
133137
}
134138

@@ -152,7 +156,7 @@ public function testContactCreateDisclose()
152156
$frame->addDisclose('voice', 1);
153157
$frame->addDisclose('email', 0);
154158

155-
$this->assertXmlStringEqualsXmlString((string) $frame,
159+
$this->assertXmlStringEqualsXmlString(
156160
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
157161
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
158162
<command>
@@ -186,7 +190,9 @@ public function testContactCreateDisclose()
186190
</contact:create>
187191
</create>
188192
</command>
189-
</epp>'
193+
</epp>
194+
',
195+
(string) $frame
190196
);
191197
}
192198
}

tests/AfriCC/EPP/Test/Frame/Command/LoginTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testLoginServices()
1717
$frame->addService('urn:ietf:params:xml:ns:domain-1.0');
1818
$frame->addService('urn:ietf:params:xml:ns:contact-1.0');
1919

20-
$this->assertXmlStringEqualsXmlString((string) $frame,
20+
$this->assertXmlStringEqualsXmlString(
2121
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
2222
<command>
2323
<login>
@@ -34,7 +34,9 @@ public function testLoginServices()
3434
</svcs>
3535
</login>
3636
</command>
37-
</epp>'
37+
</epp>
38+
',
39+
(string) $frame
3840
);
3941
}
4042

@@ -51,7 +53,7 @@ public function testLoginServicesExtensions()
5153
$frame->addServiceExtension('http://drs.ua/epp/drs-1.0');
5254
$frame->addServiceExtension('http://hostmaster.ua/epp/uaepp-1.1');
5355

54-
$this->assertXmlStringEqualsXmlString((string) $frame,
56+
$this->assertXmlStringEqualsXmlString(
5557
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5658
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
5759
<command>
@@ -73,7 +75,9 @@ public function testLoginServicesExtensions()
7375
</svcs>
7476
</login>
7577
</command>
76-
</epp>'
78+
</epp>
79+
',
80+
(string) $frame
7781
);
7882
}
7983
}

tests/AfriCC/EPP/Test/Frame/Command/Transfer/DomainTransferTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,53 @@ public function testContactCreate()
1111
{
1212
$frame = new TransferDomain();
1313
$frame->setOperation('cancel');
14-
$frame->setDomain('google.com');
14+
$frame->setDomain(TEST_DOMAIN);
1515
$frame->setPeriod('6y');
1616
$frame->setAuthInfo('password', 'REP-REP-YEP');
1717

18-
$this->assertXmlStringEqualsXmlString((string) $frame,
18+
$this->assertXmlStringEqualsXmlString(
1919
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2020
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
2121
<command>
2222
<transfer op="cancel">
2323
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
24-
<domain:name>google.com</domain:name>
24+
<domain:name>' . TEST_DOMAIN . '</domain:name>
2525
<domain:period unit="y">6</domain:period>
2626
<domain:authInfo>
2727
<domain:pw roid="REP-REP-YEP">password</domain:pw>
2828
</domain:authInfo>
2929
</domain:transfer>
3030
</transfer>
3131
</command>
32-
</epp>'
32+
</epp>
33+
',
34+
(string) $frame
3335
);
3436
}
3537

3638
public function testDomainTransferQuery()
3739
{
3840
$frame = new TransferDomain();
3941
$frame->setOperation('query');
40-
$frame->setDomain('google.com');
42+
$frame->setDomain(TEST_DOMAIN);
4143
$frame->setAuthInfo('password');
4244

43-
$this->assertXmlStringEqualsXmlString((string) $frame,
45+
$this->assertXmlStringEqualsXmlString(
4446
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
4547
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
4648
<command>
4749
<transfer op="query">
4850
<domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
49-
<domain:name>google.com</domain:name>
51+
<domain:name>' . TEST_DOMAIN . '</domain:name>
5052
<domain:authInfo>
5153
<domain:pw>password</domain:pw>
5254
</domain:authInfo>
5355
</domain:transfer>
5456
</transfer>
5557
</command>
56-
</epp>'
58+
</epp>
59+
',
60+
(string) $frame
5761
);
5862
}
5963
}

0 commit comments

Comments
 (0)