function testCreateThrowsIfInvalidData() { $this->expectException('Hypercharge\\Errors\\ValidationError'); $request = $this->request('scheduler_create.json'); $request->payment_transaction_unique_id = 'crapy-id'; $this->expect_Curl_jsonRequest()->never(); Scheduler::create($request); }
function testCreateThrowsIfTransactionHasScheduler() { $trxData = $this->transactionFixture('init_recurring_authorize.json'); $this->setStartAndEndDate($trxData['recurring_schedule']); $trx = Transaction::init_recurring_authorize($this->channel_token, $trxData); $this->assertTrue($trx->isApproved()); $this->assertIsA($trx->recurring_schedule, 'Hypercharge\\Scheduler'); $schedulerData = json_decode(JsonSchemaFixture::request('scheduler_create.json'), true); $schedulerData['payment_transaction_unique_id'] = $trx->unique_id; $this->setStartAndEndDate($schedulerData); $this->expectException('Hypercharge\\Errors\\WorkflowError'); $this->mockV2Url('scheduler'); Scheduler::create($schedulerData); }