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(); }
/** * 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(''); }