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