Пример #1
0
 /**
  * Set a Harvest client for later use.
  */
 private function setHarvestClient()
 {
     $this->harvestClient = new HarvestAPI();
     $this->harvestClient->setUser($this->config['auth']['harvest']['mail']);
     $this->harvestClient->setPassword($this->config['auth']['harvest']['pass']);
     $this->harvestClient->setAccount($this->config['auth']['harvest']['account']);
 }
Пример #2
0
 /**
  * @group internet
  */
 public function testClientsRetrieval()
 {
     $api = new HarvestAPI();
     $config = file_exists(BASE_PATH . DIRECTORY_SEPARATOR . $_SERVER['API_CONFIG_FILE']) ? json_decode(file_get_contents(BASE_PATH . DIRECTORY_SEPARATOR . $_SERVER['API_CONFIG_FILE'])) : array();
     if (!$config) {
         $this->markTestSkipped('No API config file present.');
     }
     $api->setUser($config->user);
     $api->setPassword($config->password);
     $api->setAccount($config->account);
     /** @var \Harvest\Model\Result $result */
     $result = $api->getClients();
     $this->assertInstanceOf('\\Harvest\\Model\\Result', $result);
     $this->assertTrue($result->isSuccess());
     $this->assertNotEmpty($result->get('headers'));
     $this->assertNotEmpty($result->get('data'));
 }