Пример #1
0
 /**
  * @group RoyalMail
  * 
  */
 function testInterfaceLoading()
 {
     $interface = new RoyalMail\RoyalMail();
     $this->assertTrue($interface instanceof RoyalMail\RoyalMail);
     $dev_helper = $interface->getDevelopmentHelper();
     $this->assertTrue($dev_helper instanceof RoyalMail\Helper\Development);
     $req_params = $dev_helper->getSampleRequest('cancelShipment');
     $this->assertTrue(is_array($req_params) && count($req_params) > 0);
     $response = $interface->cancelShipment($req_params);
     // $interface->processAction('cancelShipment', $req_params); // is an equivalent alternative syntax to call an API action.
     $this->assertTrue($response instanceof RoyalMail\Response\Interpreter);
     $this->assertTrue($response->succeeded());
     $this->assertEquals('RQ221150275GB', $response['cancelled_shipments'][0]);
 }
 function testSettingAuthDetails()
 {
     $rm = new \RoyalMail\RoyalMail(['application_id' => '9876543210', 'transaction_id' => 'order-234', 'username' => 'my-username', 'password' => 'my-password', 'soap_client_options' => ['local_cert' => __FILE__]]);
     $this->object($rm->cancelShipment(array_diff_key($this->getRequestParams(), ['integrationHeader' => 1])))->string($req_xml = $rm->getConnector()->getAPIFormattedRequest());
 }