Exemplo n.º 1
0
 public function testDeletePlanThrowsUnsupportedException()
 {
     $this->setExpectedException(PaystackUnsupportedOperationException::class);
     $mockPlanResource = \Mockery::mock($this->planResource)->makePartial();
     $mockPlanResource->shouldReceive('get')->withAnyArgs()->andReturn($this->planRetrievedResourceResponseData);
     $plan = new Plan($mockPlanResource);
     $plan->getPlan($this->planRetrievedResourceResponseData['plan_code'])->delete();
 }
Exemplo n.º 2
0
 /**
  * Get all plans.
  *
  * @param string $page
  *
  * @throws \Exception|mixed
  *
  * @return \Exception|mixed
  */
 public function getPlans($page = '')
 {
     $planObjects = [];
     $plans = $this->getPlanResource()->getAll($page);
     if ($plans instanceof \Exception) {
         throw $plans;
     }
     foreach ($plans as $plan) {
         $planObject = new Plan($this->getPlanResource());
         $planObjects[] = $planObject->_setAttributes($plan);
     }
     return $planObjects;
 }
 public function testSetAttributesThrowsException()
 {
     $this->setExpectedException(\InvalidArgumentException::class);
     $plan = new Plan(new PlanResource(PaystackHttpClientFactory::make()));
     $plan->_setAttributes('');
 }