/**
  * @test
  */
 public function itShouldMakeADomainRecoverInquireCall()
 {
     $taskName = 'DomainRecoverInquire';
     $responseXml = $this->getResponseXml($taskName);
     $expectedRequest = $this->getExpectedRequestXml($taskName);
     $expectedResult = new Client\Response(array('result' => array('data' => array('summary' => '1', 'restore' => array('name' => 'example.com', 'expire' => '2013-07-13 15:24:39', 'payable' => '2013-07-13 15:24:39', 'action' => 'RESTORE', 'owner' => array('user' => 'customer2', 'context' => '4'), 'created' => '2009-07-13 15:24:39')), 'status' => array('text' => 'Die wiederherstellbaren Domains wurden erfolgreich ermittelt.', 'type' => 'success', 'code' => 'S0105005')), 'stid' => '20130906-xxx-44444'));
     $client = $this->buildClientAndExpectRequestToBeSended($responseXml, $expectedRequest);
     $query = new Query();
     $task = new Request\Task\DomainRecoverInquire();
     $task->withView(array('offset' => 0, 'limit' => 1, 'children' => 0))->withKeys(array('created', 'payable', 'expire'))->withQuery($query->addAnd(array('name', 'eq', 'example.com')));
     $this->assertEquals($expectedResult, $client->call($task));
 }
Example #2
0
    /**
     * @test
     */
    public function itShouldWork()
    {
        $query = new Query();
        $task = new Request\Task\DomainInquireList();
        $task->withView(array('offset' => 0, 'limit' => 20, 'children' => 0))->withKeys(array('created', 'updated'))->withQuery($query->addOr($query->addAnd(array('name', 'like', '*.at'), array('created', 'lt', '2012-12-*')), array('name', 'like', '*.de')));
        $request = new Request($task);
        $request->setAuth(array('user' => 'username', 'password' => 'password', 'context' => 'context'));
        $expectedXml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<request>
  <auth>
    <user>username</user>
    <password>password</password>
    <context>context</context>
  </auth>
  <task>
    <code>0105</code>
    <view>
      <offset>0</offset>
      <limit>20</limit>
      <children>0</children>
    </view>
    <key>created</key>
    <key>updated</key>
    <where>
      <or>
        <and>
          <key>name</key>
          <operator>like</operator>
          <value>*.at</value>
        </and>
        <and>
          <key>created</key>
          <operator>lt</operator>
          <value>2012-12-*</value>
        </and>
      </or>
      <or>
        <key>name</key>
        <operator>like</operator>
        <value>*.de</value>
      </or>
    </where>
  </task>
</request>
XML;
        $array2Xml = new Array2Xml();
        $generatedXml = $array2Xml->buildXml('request', $request->asArray())->saveXML();
        $this->assertXmlStringEqualsXmlString($expectedXml, $generatedXml);
    }