Example #1
0
 /**
  * @covers ::__construct
  *
  * @uses Jobsity\PhpTick\Http\ApiClient::getInstance
  * @uses Jobsity\PhpTick\Http\ApiClient::__construct
  * @uses Jobsity\PhpTick\Tick::__construct
  * @uses Jobsity\PhpTick\Tick\Entry::__construct
  * @uses Jobsity\PhpTick\Tick\Task::__construct
  * @uses Jobsity\PhpTick\Tick\Project::__construct
  *
  */
 public function testConstructor()
 {
     $client = ApiClient::getInstance($this->subscriptionId, $this->accessToken, $this->company, $this->email);
     $tick = new Tick($client);
     $this->assertInstanceOf(Tick::class, $tick);
     return $tick;
 }
Example #2
0
 /**
  * Return an instance of the class.
  *
  * @param string   $subscriptionId   Subscription id of the user.
  * @param string   $accessToken      Access token of the user.
  * @param string   $company          User's company.
  * @param string   $email            User's email.
  *
  * @throws InvalidArgumentException  Throws exception if all parameters are missing
  *
  * @return \Jobsity\PhpTick\Tick    Created instance of the class.
  */
 public static function getInstance($subscriptionId, $accessToken, $company, $email)
 {
     if (!$subscriptionId || !$accessToken || !$company || !$email) {
         throw new InvalidArgumentException('You must specify a company, email address, access token and subscription id.');
     }
     $client = ApiClient::getInstance($subscriptionId, $accessToken, $company, $email);
     return new self($client);
 }
Example #3
0
 /**
  * @covers ::getInstance
  *
  * @uses Jobsity\PhpTick\Http\ApiClient::__construct
  */
 public function testGetInstance()
 {
     $apiClient = ApiClient::getInstance($this->subscriptionId, $this->accessToken, $this->company, $this->email);
     $this->assertInstanceOf(ApiClient::class, $apiClient);
 }