-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make addDisclose usefuller (fixes #1)
- Loading branch information
Gunter Grodotzki
committed
Apr 21, 2015
1 parent
1a0ea77
commit 98987cf
Showing
7 changed files
with
274 additions
and
7 deletions.
There are no files selected for viewing
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,31 @@ | ||
<?php | ||
|
||
// debug | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', true); | ||
|
||
chdir(__DIR__); | ||
|
||
require '../src/AfriCC/autoload.php'; | ||
|
||
use AfriCC\EPP\Frame\Command\Create\Contact as CreateContact; | ||
|
||
$frame = new CreateContact; | ||
$frame->skipInt(); | ||
$frame->setId('CONTACT1'); | ||
$frame->setName('Günter Grodotzki'); | ||
$frame->setOrganization('weheartwebsites UG'); | ||
$frame->addStreet('Rönskenstraße 23'); | ||
$frame->addStreet('Around the Corner'); | ||
$frame->setCity('Cape Town'); | ||
$frame->setProvince('WC'); | ||
$frame->setPostalCode('8001'); | ||
$frame->setCountryCode('ZA'); | ||
$frame->setVoice('+27.844784784'); | ||
$frame->setFax('+1.844784784'); | ||
$frame->setEmail('[email protected]'); | ||
$auth = $frame->setAuthInfo(); | ||
$frame->addDisclose('voice', 1); | ||
$frame->addDisclose('email', 0); | ||
echo $frame; | ||
var_dump($auth); |
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
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,24 @@ | ||
<?php | ||
|
||
// debug | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', true); | ||
|
||
chdir(__DIR__); | ||
|
||
require '../src/AfriCC/autoload.php'; | ||
|
||
use AfriCC\EPP\Frame\Command\Update\Contact as UpdateContact; | ||
|
||
$frame = new UpdateContact; | ||
$frame->setId('C0054'); | ||
$frame->addCity('Voerde'); | ||
$frame->addAddStreet('Long St. 14'); | ||
$frame->addAddStreet('CBD'); | ||
$frame->changeAddStreet('Long St. 15'); | ||
$frame->changeCity('Cape Town'); | ||
$frame->removeAddStreet('Long St. 16'); | ||
$frame->removeCity('Durban'); | ||
$frame->changeAddDisclose('voice', 1); | ||
$frame->changeAddDisclose('name[@type=\'int\']', 1); | ||
echo $frame; |
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
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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
use AfriCC\EPP\Frame\Command\Create\Contact as CreateContact; | ||
|
||
class ContactTest extends \PHPUnit_Framework_TestCase | ||
class ContactCreateTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testContactCreate() | ||
{ | ||
|
@@ -130,4 +130,62 @@ public function testContactCreateSkipInt() | |
</epp>' | ||
); | ||
} | ||
|
||
public function testContactCreateDisclose() | ||
{ | ||
$frame = new CreateContact; | ||
$frame->skipInt(); | ||
$frame->setId('CONTACT1'); | ||
$frame->setName('Günter Grodotzki'); | ||
$frame->setOrganization('weheartwebsites UG'); | ||
$frame->addStreet('Rönskenstraße 23'); | ||
$frame->addStreet('Around the Corner'); | ||
$frame->setCity('Cape Town'); | ||
$frame->setProvince('WC'); | ||
$frame->setPostalCode('8001'); | ||
$frame->setCountryCode('ZA'); | ||
$frame->setVoice('+27.844784784'); | ||
$frame->setFax('+1.844784784'); | ||
$frame->setEmail('[email protected]'); | ||
$auth = $frame->setAuthInfo(); | ||
$frame->addDisclose('voice', 1); | ||
$frame->addDisclose('email', 0); | ||
|
||
$this->assertXmlStringEqualsXmlString((string) $frame, | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> | ||
<command> | ||
<create> | ||
<contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> | ||
<contact:id>CONTACT1</contact:id> | ||
<contact:postalInfo type="loc"> | ||
<contact:name>Günter Grodotzki</contact:name> | ||
<contact:org>weheartwebsites UG</contact:org> | ||
<contact:addr> | ||
<contact:street>Rönskenstraße 23</contact:street> | ||
<contact:street>Around the Corner</contact:street> | ||
<contact:city>Cape Town</contact:city> | ||
<contact:sp>WC</contact:sp> | ||
<contact:pc>8001</contact:pc> | ||
<contact:cc>ZA</contact:cc> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:voice>+27.844784784</contact:voice> | ||
<contact:fax>+1.844784784</contact:fax> | ||
<contact:email>[email protected]</contact:email> | ||
<contact:authInfo> | ||
<contact:pw>' . $auth . '</contact:pw> | ||
</contact:authInfo> | ||
<contact:disclose flag="1"> | ||
<contact:voice/> | ||
</contact:disclose> | ||
<contact:disclose flag="0"> | ||
<contact:email/> | ||
</contact:disclose> | ||
</contact:create> | ||
</create> | ||
</command> | ||
</epp>' | ||
); | ||
} | ||
} |
154 changes: 154 additions & 0 deletions
154
tests/AfriCC/EPP/Test/Frame/Command/Update/ContactUpdateTest.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,154 @@ | ||
<?php | ||
|
||
namespace AfriCC\EPP\Frame\Command; | ||
|
||
use AfriCC\EPP\Frame\Command\Update\Contact as UpdateContact; | ||
|
||
class ContactUpdateTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testContactUpdate() | ||
{ | ||
$frame = new UpdateContact; | ||
$frame->setId('C0054'); | ||
$frame->addCity('Voerde'); | ||
$frame->addAddStreet('Long St. 14'); | ||
$frame->addAddStreet('CBD'); | ||
$frame->changeAddStreet('Long St. 15'); | ||
$frame->changeCity('Cape Town'); | ||
$frame->removeAddStreet('Long St. 16'); | ||
$frame->removeCity('Durban'); | ||
|
||
$this->assertXmlStringEqualsXmlString((string) $frame, | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> | ||
<command> | ||
<update> | ||
<contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> | ||
<contact:id>C0054</contact:id> | ||
<contact:add> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:city>Voerde</contact:city> | ||
<contact:street>Long St. 14</contact:street> | ||
<contact:street>CBD</contact:street> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:city>Voerde</contact:city> | ||
<contact:street>Long St. 14</contact:street> | ||
<contact:street>CBD</contact:street> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
</contact:add> | ||
<contact:chg> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:street>Long St. 15</contact:street> | ||
<contact:city>Cape Town</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:street>Long St. 15</contact:street> | ||
<contact:city>Cape Town</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
</contact:chg> | ||
<contact:rem> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:street>Long St. 16</contact:street> | ||
<contact:city>Durban</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:street>Long St. 16</contact:street> | ||
<contact:city>Durban</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
</contact:rem> | ||
</contact:update> | ||
</update> | ||
</command> | ||
</epp>' | ||
); | ||
} | ||
|
||
public function testContactUpdateDisclose() | ||
{ | ||
$frame = new UpdateContact; | ||
$frame->setId('C0054'); | ||
$frame->addCity('Voerde'); | ||
$frame->addAddStreet('Long St. 14'); | ||
$frame->addAddStreet('CBD'); | ||
$frame->changeAddStreet('Long St. 15'); | ||
$frame->changeCity('Cape Town'); | ||
$frame->removeAddStreet('Long St. 16'); | ||
$frame->removeCity('Durban'); | ||
$frame->changeAddDisclose('voice', 1); | ||
$frame->changeAddDisclose('name[@type=\'int\']', 1); | ||
|
||
$this->assertXmlStringEqualsXmlString((string) $frame, | ||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> | ||
<command> | ||
<update> | ||
<contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> | ||
<contact:id>C0054</contact:id> | ||
<contact:add> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:city>Voerde</contact:city> | ||
<contact:street>Long St. 14</contact:street> | ||
<contact:street>CBD</contact:street> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:city>Voerde</contact:city> | ||
<contact:street>Long St. 14</contact:street> | ||
<contact:street>CBD</contact:street> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
</contact:add> | ||
<contact:chg> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:street>Long St. 15</contact:street> | ||
<contact:city>Cape Town</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:street>Long St. 15</contact:street> | ||
<contact:city>Cape Town</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:disclose flag="1"> | ||
<contact:voice/> | ||
<contact:name type="int"/> | ||
</contact:disclose> | ||
</contact:chg> | ||
<contact:rem> | ||
<contact:postalInfo type="loc"> | ||
<contact:addr> | ||
<contact:street>Long St. 16</contact:street> | ||
<contact:city>Durban</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
<contact:postalInfo type="int"> | ||
<contact:addr> | ||
<contact:street>Long St. 16</contact:street> | ||
<contact:city>Durban</contact:city> | ||
</contact:addr> | ||
</contact:postalInfo> | ||
</contact:rem> | ||
</contact:update> | ||
</update> | ||
</command> | ||
</epp>' | ||
); | ||
} | ||
} |