mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Tests for dynamic payment type test
This commit is contained in:
parent
e62f6ebba4
commit
3286ff52ee
@ -74,6 +74,48 @@ class PaymentType extends StaticModel
|
||||
const KLARNA = 47;
|
||||
const Interac_E_Transfer = 48;
|
||||
|
||||
public array $type_names = [
|
||||
self::CREDIT => 'payment_type_Credit',
|
||||
self::ACH => 'payment_type_ACH',
|
||||
self::VISA => 'payment_type_Visa Card',
|
||||
self::MASTERCARD => 'payment_type_MasterCard',
|
||||
self::AMERICAN_EXPRESS => 'payment_type_American Express',
|
||||
self::DISCOVER => 'payment_type_Discover Card',
|
||||
self::DINERS => 'payment_type_Diners Card',
|
||||
self::EUROCARD => 'payment_type_EuroCard',
|
||||
self::NOVA => 'payment_type_Nova',
|
||||
self::CREDIT_CARD_OTHER => 'payment_type_Credit Card Other',
|
||||
self::PAYPAL => 'payment_type_PayPal',
|
||||
self::CHECK => 'payment_type_Check',
|
||||
self::CARTE_BLANCHE => 'payment_type_Carte Blanche',
|
||||
self::UNIONPAY => 'payment_type_UnionPay',
|
||||
self::JCB => 'payment_type_JCB',
|
||||
self::LASER => 'payment_type_Laser',
|
||||
self::MAESTRO => 'payment_type_Maestro',
|
||||
self::SOLO => 'payment_type_Solo',
|
||||
self::SWITCH => 'payment_type_Switch',
|
||||
self::ALIPAY => 'payment_type_Alipay',
|
||||
self::SOFORT => 'payment_type_Sofort',
|
||||
self::SEPA => 'payment_type_SEPA',
|
||||
self::GOCARDLESS => 'payment_type_GoCardless',
|
||||
self::CRYPTO => 'payment_type_Crypto',
|
||||
self::MOLLIE_BANK_TRANSFER => 'payment_type_Mollie Bank Transfer',
|
||||
self::KBC => 'payment_type_KBC/CBC',
|
||||
self::BANCONTACT => 'payment_type_Bancontact',
|
||||
self::IDEAL => 'payment_type_iDEAL',
|
||||
self::HOSTED_PAGE => 'payment_type_Hosted Page',
|
||||
self::GIROPAY => 'payment_type_GiroPay',
|
||||
self::PRZELEWY24 => 'payment_type_Przelewy24',
|
||||
self::EPS => 'payment_type_EPS',
|
||||
self::DIRECT_DEBIT => 'payment_type_Direct Debit',
|
||||
self::BECS => 'payment_type_BECS',
|
||||
self::ACSS => 'payment_type_ACSS',
|
||||
self::INSTANT_BANK_PAY => 'payment_type_Instant Bank Pay',
|
||||
self::FPX => 'fpx',
|
||||
self::KLARNA => 'payment_type_Klarna',
|
||||
self::Interac_E_Transfer => 'payment_type_Interac E Transfer',
|
||||
];
|
||||
|
||||
public static function parseCardType($cardName)
|
||||
{
|
||||
$cardTypes = [
|
||||
|
@ -138,7 +138,7 @@ class RandomDataSeeder extends Seeder
|
||||
];
|
||||
|
||||
foreach ($permission_users as $p_user) {
|
||||
nlog($p_user);
|
||||
|
||||
$user = User::firstOrNew([
|
||||
'email' => "{$p_user}@example.com",
|
||||
]);
|
||||
|
@ -4852,7 +4852,6 @@ $LANG = array(
|
||||
'cash_vs_accrual_help' => 'Turn on for accrual reporting, turn off for cash basis reporting.',
|
||||
'expense_paid_report' => 'Expensed reporting',
|
||||
'expense_paid_report_help' => 'Turn on for reporting all expenses, turn off for reporting only paid expenses',
|
||||
'payment_type_Klarna' => 'Klarna',
|
||||
'online_payment_email_help' => 'Send an email when an online payment is made',
|
||||
'manual_payment_email_help' => 'Send an email when manually entering a payment',
|
||||
'mark_paid_payment_email_help' => 'Send an email when marking an invoice as paid',
|
||||
@ -5015,6 +5014,8 @@ $LANG = array(
|
||||
'authorization_failure' => 'Insufficient permissions to perform this action',
|
||||
'authorization_sms_failure' => 'Please verify your account to send emails.',
|
||||
'white_label_body' => 'Thank you for purchasing a white label license. <br><br> Your license key is: <br><br> :license_key',
|
||||
'payment_type_Klarna' => 'Klarna',
|
||||
'payment_type_Interac E Transfer' => 'Interac E Transfer',
|
||||
|
||||
);
|
||||
|
||||
|
40
tests/Unit/PaymentTypeTest.php
Normal file
40
tests/Unit/PaymentTypeTest.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Models\PaymentType
|
||||
*/
|
||||
class PaymentTypeTest extends TestCase
|
||||
{
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
public function testTranslationsExist()
|
||||
{
|
||||
$payment_type_class = new PaymentType;
|
||||
|
||||
foreach($payment_type_class->type_names as $type)
|
||||
{nlog($type);
|
||||
$this->assertTrue(Lang::has("texts.{$type}"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user