public function testCreatePlanReturnsException() { $errorResponse = new \stdClass(); $errorResponse->message = 'Paystack Validation Exception'; $mockPlanResource = \Mockery::mock($this->planResource)->makePartial(); $mockPlanResource->shouldReceive('save')->withAnyArgs()->andReturn(new PaystackValidationException($errorResponse, 400)); $plan = new Plan($mockPlanResource); $this->setExpectedException(PaystackValidationException::class); $createdPlan = $plan->make($this->planData['name'], $this->planData['description'], $this->planData['amount'], $this->planData['currency'])->save(); }