Example #1
0
 function send_remote_connection($remote_url)
 {
     $faker = \Faker\Factory::create();
     $faker->addProvider(new \Faker\Provider\UserAgent($faker));
     $options = array('body' => '', 'type' => 'GET', 'url' => $remote_url, 'timeout' => Config::getNetworkTimeout(), 'ca_bundle' => Config::getCertificateBundle(), 'user_login' => Config::getUsername() . ':' . Config::getPassword(), 'user_agent' => $faker->userAgent);
     $this->prepareRequestBody($options);
     $this->shouldNotThrow()->during('execute');
     $this->getResponseBody()->shouldNotBeEmpty();
     // Check only the gate for time as its the only endpoint that provides server-time
     if (strpos($remote_url, 'gate.')) {
         $this->getResponseBody()->shouldNotBeOlder();
     }
     $this->getStatus()->shouldBe(200);
 }
 /**
  * Set Header/Body of the HTTP request
  *
  * @param \Genesis\API\Request $apiContext
  */
 public function setApiCtxData($apiContext)
 {
     $this->context->prepareRequestBody(array('body' => $apiContext->getDocument(), 'url' => $apiContext->getApiConfig('url'), 'type' => $apiContext->getApiConfig('type'), 'port' => $apiContext->getApiConfig('port'), 'protocol' => $apiContext->getApiConfig('protocol'), 'timeout' => \Genesis\Config::getNetworkTimeout(), 'ca_bundle' => \Genesis\Config::getCertificateBundle(), 'user_agent' => sprintf('Genesis PHP Client v%s', \Genesis\Config::getVersion()), 'user_login' => sprintf('%s:%s', \Genesis\Config::getUsername(), \Genesis\Config::getPassword())));
 }