function testNotificationMissingPasswordThrows() { $postData = $this->schemaNotification('transaction_notification.json'); Config::set('username', '', Config::ENV_SANDBOX); $this->assertEqual('', Config::getPassword()); try { Transaction::notification($postData); $this->fail('Errors\\ArgumentError expected!'); } catch (Errors\ArgumentError $exe) { $this->assertEqual('password is not configured! See Hypercharge\\Config::set()', $exe->getMessage()); return; } catch (Exception $exe) { $this->fail('unexpected Exception: ' . $exe->toString()); } }
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); }