mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
PHP CS Fixer
This commit is contained in:
parent
74411da11f
commit
8160af4ef4
@ -53,7 +53,7 @@ class AccountEmailQuotaTest extends TestCase
|
||||
]);
|
||||
|
||||
$hash = \Illuminate\Support\Str::random(32);
|
||||
|
||||
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $hash,
|
||||
|
@ -26,7 +26,7 @@ class ActivityApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -35,7 +35,7 @@ class ActivityApiTest extends TestCase
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
}
|
||||
@ -286,7 +286,7 @@ class ActivityApiTest extends TestCase
|
||||
|
||||
public function testActivityEntity()
|
||||
{
|
||||
|
||||
|
||||
$invoice = $this->company->invoices()->first();
|
||||
|
||||
$invoice->service()->markSent()->markPaid()->markDeleted()->handleRestore()->save();
|
||||
@ -298,11 +298,11 @@ class ActivityApiTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/activities/entity', $data);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/activities/entity', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ class ApplePayDomainMerchantUrlTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -43,12 +43,12 @@ class ApplePayDomainMerchantUrlTest extends TestCase
|
||||
$this->markTestSkipped('Skip test no company gateways installed');
|
||||
// }
|
||||
|
||||
$config = new \stdClass;
|
||||
$config = new \stdClass();
|
||||
$config->publishableKey = 'pk_test';
|
||||
$config->apiKey = 'sk_test';
|
||||
$config->appleDomainVerification = 'merchant_id';
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
|
@ -26,7 +26,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -41,7 +41,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
|
||||
public function testMatchCreditOnInvoiceNumber()
|
||||
{
|
||||
|
||||
|
||||
$bi = BankIntegration::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -154,7 +154,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'applies_to' => 'DEBIT',
|
||||
'client_id' => $this->client->id,
|
||||
'vendor_id' => $this->vendor->id,
|
||||
'category_id' =>$this->expense_category->id,
|
||||
'category_id' => $this->expense_category->id,
|
||||
'rules' => [
|
||||
[
|
||||
'search_key' => 'description',
|
||||
@ -167,7 +167,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
$bt = $bt->refresh();
|
||||
|
||||
$debit_rules = $bt->company->debit_rules();
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
$bt = $bt->fresh();
|
||||
@ -175,7 +175,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
$this->assertNotNull($bt->expense_id);
|
||||
// $this->assertNotNull($bt->expense->category_id);
|
||||
// $this->assertNotNull($bt->expense->vendor_id);
|
||||
|
||||
|
||||
$bt = null;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testMatchingBankTransactionExpenseAmountLessThanEqualTo()
|
||||
@ -258,8 +258,8 @@ class BankTransactionRuleTest extends TestCase
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
$bt->company->refresh();
|
||||
|
||||
$bt->refresh()->service()->processRules();
|
||||
@ -268,7 +268,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
|
||||
$this->assertNotNull($bt->expense_id);
|
||||
|
||||
$bt=null;
|
||||
$bt = null;
|
||||
}
|
||||
|
||||
|
||||
@ -305,7 +305,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 99
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -347,7 +347,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 101
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->refresh()->service()->processRules();
|
||||
|
||||
@ -390,7 +390,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 101
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -432,7 +432,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -475,7 +475,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
$bt = $bt->refresh();
|
||||
|
||||
$bt->service()->processRules();
|
||||
@ -520,7 +520,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->load('company');
|
||||
|
||||
$bt->service()->processRules();
|
||||
@ -564,7 +564,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -608,7 +608,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -651,7 +651,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -694,7 +694,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'base_type' => 'DEBIT',
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -735,7 +735,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'description' => 'Wall',
|
||||
'base_type' => 'DEBIT',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -776,7 +776,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
'description' => 'WallABy',
|
||||
'base_type' => 'DEBIT',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$bt->service()->processRules();
|
||||
|
||||
@ -822,7 +822,7 @@ class BankTransactionRuleTest extends TestCase
|
||||
// 'base_type' => 'CREDIT',
|
||||
// 'amount' => 100
|
||||
// ]);
|
||||
|
||||
|
||||
|
||||
// $bt->service()->processRules();
|
||||
|
||||
|
@ -29,7 +29,7 @@ class BankTransactionTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -59,7 +59,7 @@ class BankTransactionTest extends TestCase
|
||||
$bt->base_type = 'DEBIT';
|
||||
$bt->save();
|
||||
|
||||
|
||||
|
||||
$bi2 = BankIntegrationFactory::create($this->company->id, $this->user->id, $this->account->id);
|
||||
$bi2->bank_account_name = "Bank2";
|
||||
$bi2->save();
|
||||
@ -86,7 +86,7 @@ class BankTransactionTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$transaction_count = count($arr['data']);
|
||||
|
||||
|
||||
$this->assertGreaterThan(1, $transaction_count);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
@ -216,7 +216,7 @@ class BankTransactionTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
|
||||
$this->assertNotNull($e2->refresh()->transaction_id);
|
||||
|
||||
|
||||
$this->assertEquals("{$this->expense->hashed_id},{$e->hashed_id},{$e2->hashed_id}", $bt->fresh()->expense_id);
|
||||
|
||||
$expense_repo = app('App\Repositories\ExpenseRepository');
|
||||
@ -475,7 +475,7 @@ class BankTransactionTest extends TestCase
|
||||
public function testMatchBankTransactionsValidationShouldFail()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
|
||||
$data['transactions'][] = [
|
||||
'bad_key' => 10,
|
||||
];
|
||||
|
@ -23,7 +23,7 @@ class YodleeBankTransactionTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -80,7 +80,7 @@ class YodleeBankTransactionTest extends TestCase
|
||||
$bank_transaction = BankTransaction::where('company_id', $this->company->id)->first();
|
||||
$bank_transaction->description = "super-funk-123";
|
||||
$bank_transaction->save();
|
||||
|
||||
|
||||
$this->assertNotNull($this->invoice);
|
||||
$this->assertNotNull($bank_transaction);
|
||||
|
||||
|
@ -29,8 +29,8 @@ class BankIntegrationApiTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -33,7 +33,7 @@ class BankTransactionApiTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -48,7 +48,7 @@ class BankTransactionApiTest extends TestCase
|
||||
|
||||
public function testBankTransactionCreate()
|
||||
{
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -129,7 +129,7 @@ class BankTransactionApiTest extends TestCase
|
||||
public function testBankTransactionUnlink()
|
||||
{
|
||||
BankTransaction::truncate();
|
||||
|
||||
|
||||
$bi = BankIntegration::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -149,7 +149,7 @@ class BankTransactionApiTest extends TestCase
|
||||
'expense_id' => "{$this->expense->hashed_id},{$e->hashed_id}",
|
||||
'invoice_ids' => $this->invoice->hashed_id,
|
||||
]);
|
||||
|
||||
|
||||
$e->transaction_id = $bank_transaction->id;
|
||||
$e->save();
|
||||
|
||||
|
@ -28,7 +28,7 @@ class BankTransactionRuleApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -104,7 +104,7 @@ class BaseApiTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -161,7 +161,7 @@ class BaseApiTest extends TestCase
|
||||
|
||||
$user_id = $owner_user->id;
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $owner_user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -186,7 +186,7 @@ class BaseApiTest extends TestCase
|
||||
|
||||
$this->low_token = \Illuminate\Support\Str::random(64);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $lower_permission_user->id;
|
||||
$company_token->company_id = $this->company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -326,7 +326,7 @@ class BaseApiTest extends TestCase
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
$gs = new GroupSetting;
|
||||
$gs = new GroupSetting();
|
||||
$gs->name = 'Test';
|
||||
$gs->company_id = $client->company_id;
|
||||
$gs->settings = ClientSettings::buildClientSettings($company->settings, $client->settings);
|
||||
@ -372,7 +372,7 @@ class BaseApiTest extends TestCase
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user_id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -397,7 +397,7 @@ class BaseApiTest extends TestCase
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Tests admin/owner facing routes respond with the correct status and/or data set
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ class CancelInvoiceTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -25,7 +25,7 @@ class ClassificationTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ClientMergeTest extends TestCase
|
||||
private $primary_contact;
|
||||
|
||||
public $faker;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
@ -46,7 +46,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -74,7 +74,7 @@ class ClientApiTest extends TestCase
|
||||
"action" => "bulk_update",
|
||||
"ids" => Client::where('company_id', $this->company->id)->get()->pluck("hashed_id")
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/bulk", $data);
|
||||
@ -88,7 +88,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
public function testCountryCodeValidation()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_code' => 'USA',
|
||||
@ -128,14 +128,14 @@ class ClientApiTest extends TestCase
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
$this->assertEquals($this->company->settings->country_id, $arr['data']['country_id']);
|
||||
|
||||
}
|
||||
|
||||
public function testIdNumberPutValidation()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_id' => '840',
|
||||
@ -147,7 +147,7 @@ class ClientApiTest extends TestCase
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_id' => '840',
|
||||
@ -175,7 +175,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
public function testNumberPutValidation()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_id' => '840',
|
||||
@ -187,7 +187,7 @@ class ClientApiTest extends TestCase
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_id' => '840',
|
||||
@ -223,13 +223,13 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/",$data)
|
||||
])->postJson("/api/v1/clients/", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("x-1-11", $arr['data']['number']);
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'country_id' => '840',
|
||||
@ -274,7 +274,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -292,7 +292,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(422);
|
||||
|
||||
}
|
||||
@ -307,7 +307,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/",$data)
|
||||
])->postJson("/api/v1/clients/", $data)
|
||||
->assertStatus(422);
|
||||
|
||||
}
|
||||
@ -322,12 +322,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/",$data)
|
||||
])->postJson("/api/v1/clients/", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("8", $arr['data']['country_id']);
|
||||
$this->assertEquals("8", $arr['data']['country_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -342,12 +342,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/",$data)
|
||||
])->postJson("/api/v1/clients/", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("2", $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals("2", $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -362,12 +362,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("2", $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals("2", $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -382,12 +382,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("1", $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals("1", $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -402,12 +402,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -422,12 +422,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id,$data)
|
||||
])->putJson("/api/v1/clients/".$this->client->hashed_id, $data)
|
||||
->assertStatus(422);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
// $this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
// $this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -442,12 +442,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients",$data)
|
||||
])->postJson("/api/v1/clients", $data)
|
||||
->assertStatus(422);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
// $this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
// $this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -462,12 +462,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients",$data)
|
||||
])->postJson("/api/v1/clients", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -480,12 +480,12 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients",$data)
|
||||
])->postJson("/api/v1/clients", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
$this->assertEquals($this->company->settings->currency_id, $arr['data']['settings']['currency_id']);
|
||||
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ class ClientApiTest extends TestCase
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients",$data)
|
||||
])->postJson("/api/v1/clients", $data)
|
||||
->assertStatus(200);
|
||||
|
||||
}
|
||||
@ -548,7 +548,7 @@ class ClientApiTest extends TestCase
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson("/api/v1/clients/{$this->client->hashed_id}", $data)
|
||||
->assertStatus(422);
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'name of client',
|
||||
'documents' => [],
|
||||
@ -563,13 +563,13 @@ class ClientApiTest extends TestCase
|
||||
|
||||
public function testClientDocumentQuery()
|
||||
{
|
||||
|
||||
|
||||
$d = \App\Models\Document::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
$this->invoice->documents()->save($d);
|
||||
$this->invoice->documents()->save($d);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -612,7 +612,7 @@ class ClientApiTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertCount(3, $arr['data']);
|
||||
|
||||
|
||||
$d = \App\Models\Document::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -654,7 +654,7 @@ class ClientApiTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$e = \App\Models\Expense::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -675,29 +675,29 @@ class ClientApiTest extends TestCase
|
||||
$this->assertCount(6, $arr['data']);
|
||||
|
||||
|
||||
$d = \App\Models\Document::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
$d = \App\Models\Document::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
|
||||
$t = \App\Models\Task::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
$t = \App\Models\Task::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$t->documents()->save($d);
|
||||
$t->documents()->save($d);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/{$this->client->hashed_id}/documents")
|
||||
->assertStatus(200);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson("/api/v1/clients/{$this->client->hashed_id}/documents")
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertCount(7, $arr['data']);
|
||||
$this->assertCount(7, $arr['data']);
|
||||
|
||||
|
||||
|
||||
@ -733,7 +733,7 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$different_company_token = \Illuminate\Support\Str::random(64);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
@ -801,7 +801,7 @@ $this->assertCount(7, $arr['data']);
|
||||
'action' => 'archive',
|
||||
'ids' =>
|
||||
$this->client->hashed_id
|
||||
|
||||
|
||||
];
|
||||
|
||||
$v = $this->app['validator']->make($data, $rules);
|
||||
@ -830,13 +830,13 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$this->assertTrue($response->headers->get('content-type') == 'application/pdf');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testClientStatementEmail()
|
||||
{
|
||||
$response = null;
|
||||
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'start_date' => '2000-01-01',
|
||||
@ -846,11 +846,11 @@ $this->assertCount(7, $arr['data']);
|
||||
'status' => 'paid',
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/client_statement?send_email=true', $data);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/client_statement?send_email=true', $data);
|
||||
|
||||
|
||||
$response->assertJson([
|
||||
'message' => ctrans('texts.email_queued'),
|
||||
@ -931,7 +931,7 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
public function testClientSettingsSave()
|
||||
{
|
||||
$std = new \stdClass;
|
||||
$std = new \stdClass();
|
||||
$std->entity = 'App\\Models\\Client';
|
||||
$std->currency_id = 3;
|
||||
|
||||
@ -945,7 +945,7 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
public function testClientSettingsSave2()
|
||||
{
|
||||
$std = new \stdClass;
|
||||
$std = new \stdClass();
|
||||
$std->entity = 'App\\Models\\Client';
|
||||
$std->industry_id = '';
|
||||
$std->size_id = '';
|
||||
@ -1022,7 +1022,7 @@ $this->assertCount(7, $arr['data']);
|
||||
$repository = app()->make($repository_name);
|
||||
$repository->import_mode = true;
|
||||
|
||||
$_syn_request_class = new $request_name;
|
||||
$_syn_request_class = new $request_name();
|
||||
$_syn_request_class->setContainer(app());
|
||||
$_syn_request_class->initialize($data);
|
||||
$_syn_request_class->prepareForValidation();
|
||||
@ -1123,10 +1123,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -1156,11 +1156,11 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
@ -1178,10 +1178,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -1201,10 +1201,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -1224,10 +1224,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -1242,10 +1242,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@ -1259,10 +1259,10 @@ $this->assertCount(7, $arr['data']);
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -1280,7 +1280,7 @@ $this->assertCount(7, $arr['data']);
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/', $data);
|
||||
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@ -1399,7 +1399,7 @@ $this->assertCount(7, $arr['data']);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients/bulk?action=archive', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
$this->assertNotNull($arr['data'][0]['archived_at']);
|
||||
|
@ -29,7 +29,7 @@ class ClientDeletedInvoiceCreationTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,8 +32,8 @@ class ClientGatewayTokenApiTest extends TestCase
|
||||
|
||||
protected $faker;
|
||||
protected CompanyGateway $cg;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -87,7 +87,7 @@ class ClientGatewayTokenApiTest extends TestCase
|
||||
//disable ach here
|
||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
||||
|
||||
$this->cg = new CompanyGateway;
|
||||
$this->cg = new CompanyGateway();
|
||||
$this->cg->company_id = $this->company->id;
|
||||
$this->cg->user_id = $this->user->id;
|
||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
|
@ -27,7 +27,7 @@ class ClientModelTest extends TestCase
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -41,8 +41,9 @@ class ClientModelTest extends TestCase
|
||||
$this->markTestSkipped('Skip test no company gateways installed');
|
||||
}
|
||||
|
||||
if(CompanyGateway::count() == 0)
|
||||
if(CompanyGateway::count() == 0) {
|
||||
$this->markTestSkipped('Skip test no company gateways installed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +52,7 @@ class ClientModelTest extends TestCase
|
||||
|
||||
$this->invoice->amount = 10;
|
||||
$this->invoice->balance = 10;
|
||||
$this->invoice->status_id=2;
|
||||
$this->invoice->status_id = 2;
|
||||
$this->invoice->date = now()->subDays(2);
|
||||
$this->invoice->due_date = now()->addDays(2);
|
||||
$this->invoice->save();
|
||||
@ -61,7 +62,7 @@ class ClientModelTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$cd2 = Client::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -106,7 +107,7 @@ class ClientModelTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals($invoice_count+2, count($arr['data']));
|
||||
$this->assertEquals($invoice_count + 2, count($arr['data']));
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
@ -168,7 +169,7 @@ class ClientModelTest extends TestCase
|
||||
|
||||
public function testPaymentMethodsWithCreditsEnforced()
|
||||
{
|
||||
|
||||
|
||||
$payment_methods = $this->client->service()->getPaymentMethods(40);
|
||||
|
||||
$this->assertGreaterThan(0, CompanyGateway::count());
|
||||
|
@ -25,22 +25,23 @@ use App\Utils\Traits\AppSetup;
|
||||
use Faker\Factory;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Livewire\Livewire;
|
||||
use function now;
|
||||
use Tests\TestCase;
|
||||
|
||||
use function now;
|
||||
|
||||
class CreditsTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
use AppSetup;
|
||||
|
||||
private $faker;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->faker = Factory::create();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testShowingOnlyCreditsWithDueDateLessOrEqualToNow()
|
||||
|
@ -31,7 +31,7 @@ class InvoicesTest extends TestCase
|
||||
use AppSetup;
|
||||
|
||||
public $faker;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
@ -24,7 +24,7 @@ class ClientPresenterTest extends TestCase
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -49,8 +49,8 @@ class ClientTest extends TestCase
|
||||
public $faker;
|
||||
|
||||
public $client_id;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -105,8 +105,8 @@ class ClientTest extends TestCase
|
||||
$this->assertEquals($gs->id, $c->group_settings_id);
|
||||
});
|
||||
|
||||
foreach($arr['data'] as $client_response){
|
||||
|
||||
foreach($arr['data'] as $client_response) {
|
||||
|
||||
$this->assertEquals($gs->hashed_id, $client_response['group_settings_id']);
|
||||
}
|
||||
}
|
||||
@ -128,14 +128,14 @@ class ClientTest extends TestCase
|
||||
|
||||
$this->company->saveSettings($settings, $this->company);
|
||||
|
||||
$client_exchange_rate = round($c->setExchangeRate(),2);
|
||||
$client_exchange_rate = round($c->setExchangeRate(), 2);
|
||||
|
||||
$aud_currency = Currency::find(12);
|
||||
$eur_currency = Currency::find(3);
|
||||
|
||||
$synthetic_exchange = $aud_currency->exchange_rate / $eur_currency->exchange_rate;
|
||||
|
||||
$this->assertEquals($client_exchange_rate, round($synthetic_exchange,2));
|
||||
$this->assertEquals($client_exchange_rate, round($synthetic_exchange, 2));
|
||||
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ class ClientTest extends TestCase
|
||||
'company_id' => $this->company->id,
|
||||
'email' => ''
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$this->assertEquals(2, $c->contacts->count());
|
||||
$this->assertEquals(3, $c1->contacts->count());
|
||||
@ -254,7 +254,7 @@ class ClientTest extends TestCase
|
||||
{
|
||||
$line_items = [];
|
||||
|
||||
for ($x=0; $x<$number; $x++) {
|
||||
for ($x = 0; $x < $number; $x++) {
|
||||
$item = InvoiceItemFactory::create();
|
||||
$item->quantity = 1;
|
||||
$item->cost = 10;
|
||||
@ -570,7 +570,7 @@ class ClientTest extends TestCase
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
@ -625,7 +625,7 @@ class ClientTest extends TestCase
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
|
@ -34,7 +34,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
use MockAccountData;
|
||||
use CompanyGatewayFeesAndLimitsSaver;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -164,7 +164,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
|
||||
public function testCompanyGatewayFeesAndLimitsSuccess()
|
||||
{
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
|
||||
$fee = (array) $fee;
|
||||
|
||||
@ -224,7 +224,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
|
||||
public function testCompanyGatewayFeesAndLimitsFails()
|
||||
{
|
||||
$fee_and_limit['bank_transfer'] = new FeesAndLimits;
|
||||
$fee_and_limit['bank_transfer'] = new FeesAndLimits();
|
||||
|
||||
$fee_and_limit['bank_transfer']->adjust_fee_percent = 10;
|
||||
|
||||
@ -250,7 +250,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
'max_limit' => 2,
|
||||
];
|
||||
|
||||
$fal = (array) new FeesAndLimits;
|
||||
$fal = (array) new FeesAndLimits();
|
||||
|
||||
$new_arr = array_replace($fal, $arr);
|
||||
|
||||
@ -261,7 +261,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeeAmountCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
// $fee->fee_tax_name1 = 'GST';
|
||||
@ -294,7 +294,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
//$fee->fee_amount = 10;
|
||||
$fee->fee_percent = 2;
|
||||
// $fee->fee_tax_name1 = 'GST';
|
||||
@ -327,7 +327,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
$fee->fee_percent = 2;
|
||||
// $fee->fee_tax_name1 = 'GST';
|
||||
@ -360,7 +360,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercent()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 0;
|
||||
$fee->fee_percent = 100;
|
||||
$fee->adjust_fee_percent = false;
|
||||
@ -393,7 +393,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
|
||||
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercentVariationOne()
|
||||
{
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 0;
|
||||
$fee->fee_percent = 10;
|
||||
|
||||
@ -424,7 +424,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
$fee->fee_tax_name1 = 'GST';
|
||||
@ -457,7 +457,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuationInclusiveTaxes()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
$fee->fee_tax_name1 = 'GST';
|
||||
@ -490,7 +490,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
$fee->fee_tax_name1 = 'GST';
|
||||
@ -525,7 +525,7 @@ class CompanyGatewayApiTest extends TestCase
|
||||
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuationWithFeeCap()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee = new FeesAndLimits();
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
$fee->fee_tax_name1 = 'GST';
|
||||
|
@ -35,7 +35,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
|
||||
public $cg1;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -55,7 +55,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg){
|
||||
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg) {
|
||||
$cg->forceDelete();
|
||||
});
|
||||
|
||||
@ -91,7 +91,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
//disable ach here
|
||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
||||
|
||||
$this->cg = new CompanyGateway;
|
||||
$this->cg = new CompanyGateway();
|
||||
$this->cg->company_id = $this->company->id;
|
||||
$this->cg->user_id = $this->user->id;
|
||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -148,7 +148,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg) {
|
||||
$cg->forceDelete();
|
||||
});
|
||||
|
||||
|
||||
Credit::query()->withTrashed()->cursor()->each(function ($c) {
|
||||
$c->forceDelete();
|
||||
});
|
||||
@ -185,7 +185,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
//disable ach here
|
||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
||||
|
||||
$this->cg = new CompanyGateway;
|
||||
$this->cg = new CompanyGateway();
|
||||
$this->cg->company_id = $this->company->id;
|
||||
$this->cg->user_id = $this->user->id;
|
||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -237,7 +237,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
//disable ach here
|
||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
||||
|
||||
$this->cg = new CompanyGateway;
|
||||
$this->cg = new CompanyGateway();
|
||||
$this->cg->company_id = $this->company->id;
|
||||
$this->cg->user_id = $this->user->id;
|
||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
|
@ -30,7 +30,7 @@ class CompanyGatewayTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
// use RefreshDatabase;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -50,7 +50,7 @@ class CompanyGatewayTest extends TestCase
|
||||
public function testSetConfigFields()
|
||||
{
|
||||
$company_gateway = CompanyGateway::first();
|
||||
|
||||
|
||||
$this->assertNotNull($company_gateway->getConfig());
|
||||
|
||||
$company_gateway->setConfigField('test', 'test');
|
||||
@ -80,7 +80,7 @@ class CompanyGatewayTest extends TestCase
|
||||
$data[1]['fee_cap'] = 0;
|
||||
$data[1]['is_enabled'] = true;
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -152,7 +152,7 @@ class CompanyGatewayTest extends TestCase
|
||||
$data[1]['fee_cap'] = 0;
|
||||
$data[1]['is_enabled'] = true;
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -191,7 +191,7 @@ class CompanyGatewayTest extends TestCase
|
||||
$data[1]['fee_cap'] = 0;
|
||||
$data[1]['is_enabled'] = true;
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -237,7 +237,7 @@ class CompanyGatewayTest extends TestCase
|
||||
$data[1]['fee_cap'] = 0;
|
||||
$data[1]['is_enabled'] = true;
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -285,7 +285,7 @@ class CompanyGatewayTest extends TestCase
|
||||
$data[1]['fee_cap'] = 0;
|
||||
$data[1]['is_enabled'] = true;
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
|
@ -8,6 +8,7 @@
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
@ -31,7 +32,7 @@ class CompanySettingsTest extends TestCase
|
||||
use MockAccountData;
|
||||
// use RefreshDatabase;
|
||||
|
||||
public function setUp() :void
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -81,7 +82,7 @@ class CompanySettingsTest extends TestCase
|
||||
$this->company->saveSettings($settings, $this->company);
|
||||
|
||||
$response = false;
|
||||
|
||||
|
||||
try {
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
|
@ -37,7 +37,7 @@ class CompanyTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -31,7 +31,7 @@ class CompanyTokenApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -29,7 +29,7 @@ class CreditTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
public $faker;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
@ -83,7 +83,7 @@ class CreditTest extends TestCase
|
||||
$i->service()->markSent()->save();
|
||||
|
||||
$this->assertEquals(100, $i->balance);
|
||||
|
||||
|
||||
$i->service()->markPaid()->save();
|
||||
$i = $i->fresh();
|
||||
$c = $c->fresh();
|
||||
@ -92,11 +92,11 @@ class CreditTest extends TestCase
|
||||
$this->assertEquals(0, $c->balance);
|
||||
|
||||
$this->assertEquals(100, $c->paid_to_date);
|
||||
|
||||
|
||||
$i->service()->handleReversal()->save();
|
||||
|
||||
|
||||
$data = $i->toArray();
|
||||
|
||||
|
||||
$data = $i->toArray();
|
||||
$data['invoice_id'] = $i->hashed_id;
|
||||
$data['user_id'] = $this->encodePrimaryKey($i->user_id);
|
||||
$data['client_id'] = $this->encodePrimaryKey($i->client_id);
|
||||
@ -122,7 +122,7 @@ class CreditTest extends TestCase
|
||||
$this->assertEquals(0, $i->balance);
|
||||
$this->assertEquals(100, $c->credit_balance);
|
||||
$this->assertEquals(0, $c->paid_to_date);
|
||||
|
||||
|
||||
$credit->service()->deleteCredit()->save();
|
||||
|
||||
$c = $c->fresh();
|
||||
@ -169,7 +169,7 @@ class CreditTest extends TestCase
|
||||
],
|
||||
'status_id' => 1,
|
||||
]);
|
||||
|
||||
|
||||
$i->save();
|
||||
|
||||
$i->calc()->getInvoice();
|
||||
@ -193,7 +193,7 @@ class CreditTest extends TestCase
|
||||
'status_id' => 1,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$cr->calc()->getCredit();
|
||||
|
||||
$cr->service()->markSent()->save();
|
||||
@ -253,10 +253,10 @@ class CreditTest extends TestCase
|
||||
$this->assertEquals(0, $c->balance);
|
||||
|
||||
$p = \App\Models\Payment::find($this->decodePrimaryKey($p_id));
|
||||
|
||||
|
||||
$this->assertEquals(0, $p->amount);
|
||||
$this->assertEquals(0, $p->applied);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -281,7 +281,7 @@ class CreditTest extends TestCase
|
||||
$this->assertEquals(100, $c->balance);
|
||||
$this->assertEquals(0, $c->paid_to_date);
|
||||
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -291,7 +291,7 @@ class CreditTest extends TestCase
|
||||
|
||||
$cr = $cr->fresh();
|
||||
|
||||
$this->assertEquals(true, $cr->is_deleted);
|
||||
$this->assertEquals(true, $cr->is_deleted);
|
||||
|
||||
$this->assertEquals(100, $c->balance);
|
||||
$this->assertEquals(0, $c->paid_to_date);
|
||||
@ -384,7 +384,7 @@ class CreditTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
$this->assertCount(1, $arr['data']);
|
||||
|
||||
|
||||
$c->status_id = Credit::STATUS_APPLIED;
|
||||
$c->amount = 20;
|
||||
$c->balance = 20;
|
||||
|
@ -31,7 +31,7 @@ class DeleteInvoiceTest extends TestCase
|
||||
use MockAccountData;
|
||||
use MakesHash;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class DesignApiTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -62,7 +62,7 @@ class DesignApiTest extends TestCase
|
||||
->where('is_template', true)
|
||||
->where('company_id', $this->company->id)
|
||||
->whereRaw('FIND_IN_SET( ? ,entities)', [$searchable]);
|
||||
|
||||
|
||||
$this->assertEquals(1, $q->count());
|
||||
|
||||
$response = $this->withHeaders([
|
||||
@ -105,7 +105,7 @@ class DesignApiTest extends TestCase
|
||||
$q = Design::query()
|
||||
->where('is_template', true)
|
||||
->whereRaw('FIND_IN_SET( ? ,entities)', [$searchable]);
|
||||
|
||||
|
||||
$this->assertEquals(0, $q->count());
|
||||
|
||||
$design = DesignFactory::create($this->company->id, $this->user->id);
|
||||
@ -119,7 +119,7 @@ class DesignApiTest extends TestCase
|
||||
$q = Design::query()
|
||||
->where('is_template', true)
|
||||
->whereRaw('FIND_IN_SET( ? ,entities)', [$searchable]);
|
||||
|
||||
|
||||
$this->assertEquals(0, $q->count());
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ class DesignApiTest extends TestCase
|
||||
$design->is_template = true;
|
||||
$design->name = 'Test Template';
|
||||
$design->save();
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -141,7 +141,7 @@ class DesignApiTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertCount(1, $arr['data']);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class DesignApiTest extends TestCase
|
||||
$design->is_template = true;
|
||||
$design->name = 'Test Template';
|
||||
$design->save();
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -160,7 +160,7 @@ class DesignApiTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertCount(11, $arr['data']);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
@ -171,7 +171,7 @@ class DesignApiTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertCount(12, $arr['data']);
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ class DocumentsApiTest extends TestCase
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -47,7 +47,7 @@ class DocumentsApiTest extends TestCase
|
||||
|
||||
public function testDocumentFilters()
|
||||
{
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||
$d->forceDelete();
|
||||
});
|
||||
|
||||
@ -73,7 +73,7 @@ class DocumentsApiTest extends TestCase
|
||||
|
||||
public function testDocumentFilters2()
|
||||
{
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||
$d->forceDelete();
|
||||
});
|
||||
|
||||
@ -98,7 +98,7 @@ class DocumentsApiTest extends TestCase
|
||||
|
||||
public function testDocumentFilters3()
|
||||
{
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
||||
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||
$d->forceDelete();
|
||||
});
|
||||
|
||||
@ -114,9 +114,9 @@ class DocumentsApiTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$t->documents()->save($d);
|
||||
|
||||
|
||||
$dd = Document::factory()->create([
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -141,7 +141,7 @@ class DocumentsApiTest extends TestCase
|
||||
])->get("/api/v1/documents?client_id={$this->client->hashed_id}&filter=craycray");
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
$this->assertCount(0, $response->json()['data']);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
@ -24,7 +24,7 @@ class FacturaeTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class FatturaPATest extends TestCase
|
||||
|
||||
$this->makeTestData();
|
||||
|
||||
|
||||
|
||||
// $this->markTestSkipped('prevent running in CI');
|
||||
|
||||
$this->withoutMiddleware(
|
||||
@ -60,20 +60,20 @@ class FatturaPATest extends TestCase
|
||||
$settings->state = 'PA';
|
||||
|
||||
// $settings->state = 'Perugia';
|
||||
$settings->postal_code = '61030';
|
||||
$settings->postal_code = '61030';
|
||||
$settings->country_id = '380';
|
||||
$settings->currency_id = '3';
|
||||
$settings->vat_number = '01234567890';
|
||||
$settings->id_number = '';
|
||||
|
||||
$company = Company::factory()->create([
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
'settings' => $settings,
|
||||
]);
|
||||
|
||||
$client_settings = ClientSettings::defaults();
|
||||
$client_settings->currency_id = '3';
|
||||
|
||||
|
||||
$client = Client::factory()->create([
|
||||
'company_id' => $company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -88,14 +88,14 @@ class FatturaPATest extends TestCase
|
||||
'settings' => $client_settings,
|
||||
]);
|
||||
|
||||
$item = new InvoiceItem;
|
||||
$item = new InvoiceItem();
|
||||
$item->product_key = "Product Key";
|
||||
$item->notes = "Product Description";
|
||||
$item->cost = 10;
|
||||
$item->quantity = 10;
|
||||
$item->tax_rate1 = 22;
|
||||
$item->tax_name1 = 'IVA';
|
||||
|
||||
|
||||
$invoice = Invoice::factory()->create([
|
||||
'company_id' => $company->id,
|
||||
'user_id' => $this->user->id,
|
||||
@ -110,7 +110,7 @@ class FatturaPATest extends TestCase
|
||||
'tax_name2' => '',
|
||||
'tax_name3' => '',
|
||||
'line_items' => [$item],
|
||||
'number' => 'ITA-'.rand(1000,100000)
|
||||
'number' => 'ITA-'.rand(1000, 100000)
|
||||
]);
|
||||
|
||||
$invoice->service()->markSent()->save();
|
||||
@ -126,11 +126,12 @@ class FatturaPATest extends TestCase
|
||||
$this->assertInstanceOf(FatturaElettronicaBody::class, $fe->FatturaElettronicaBody[0]);
|
||||
$this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader);
|
||||
|
||||
$e = new EInvoice;
|
||||
$e = new EInvoice();
|
||||
$errors = $e->validate($fe);
|
||||
|
||||
if(count($errors) > 0)
|
||||
if(count($errors) > 0) {
|
||||
nlog($errors);
|
||||
}
|
||||
|
||||
$this->assertCount(0, $errors);
|
||||
|
||||
|
@ -60,7 +60,7 @@ class PeppolTest extends TestCase
|
||||
|
||||
$settings = CompanySettings::defaults();
|
||||
$settings->address1 = 'Dudweilerstr. 34b';
|
||||
$settings->city = 'Ost Alessa';
|
||||
$settings->city = 'Ost Alessa';
|
||||
$settings->state = 'Bayern';
|
||||
$settings->postal_code = '98060';
|
||||
$settings->vat_number = 'DE923356489';
|
||||
@ -68,11 +68,11 @@ class PeppolTest extends TestCase
|
||||
$settings->currency_id = '3';
|
||||
|
||||
$einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
|
||||
|
||||
|
||||
$fib = new FinancialInstitutionBranch();
|
||||
$fib->ID = "DEUTDEMMXXX"; //BIC
|
||||
$fib->Name = 'Deutsche Bank';
|
||||
|
||||
|
||||
$pfa = new PayeeFinancialAccount();
|
||||
$pfa->ID = 'DE89370400440532013000';
|
||||
$pfa->Name = 'PFA-NAME';
|
||||
@ -83,10 +83,10 @@ class PeppolTest extends TestCase
|
||||
$pfa->FinancialInstitutionBranch = $fib;
|
||||
|
||||
$pm = new PaymentMeans();
|
||||
$pm->PayeeFinancialAccount = $pfa;
|
||||
$pm->PayeeFinancialAccount = $pfa;
|
||||
$einvoice->PaymentMeans[] = $pm;
|
||||
|
||||
$stub = new \stdClass;
|
||||
$stub = new \stdClass();
|
||||
$stub->Invoice = $einvoice;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
@ -94,7 +94,7 @@ class PeppolTest extends TestCase
|
||||
'settings' => $settings,
|
||||
'e_invoice' => $stub,
|
||||
]);
|
||||
|
||||
|
||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||
$cu->is_owner = true;
|
||||
$cu->is_admin = true;
|
||||
@ -118,7 +118,7 @@ class PeppolTest extends TestCase
|
||||
'settings' => $client_settings,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$item = new InvoiceItem();
|
||||
$item->product_key = "Product Key";
|
||||
$item->notes = "Product Description";
|
||||
@ -181,7 +181,7 @@ class PeppolTest extends TestCase
|
||||
|
||||
$settings = CompanySettings::defaults();
|
||||
$settings->address1 = 'Dudweilerstr. 34b';
|
||||
$settings->city = 'Ost Alessa';
|
||||
$settings->city = 'Ost Alessa';
|
||||
$settings->state = 'Bayern';
|
||||
$settings->postal_code = '98060';
|
||||
$settings->vat_number = 'DE923356489';
|
||||
@ -189,11 +189,11 @@ class PeppolTest extends TestCase
|
||||
$settings->currency_id = '3';
|
||||
|
||||
$einvoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
|
||||
|
||||
|
||||
$fib = new FinancialInstitutionBranch();
|
||||
$fib->ID = "DEUTDEMMXXX"; //BIC
|
||||
$fib->Name = 'Deutsche Bank';
|
||||
|
||||
|
||||
$pfa = new PayeeFinancialAccount();
|
||||
$pfa->ID = 'DE89370400440532013000';
|
||||
$pfa->Name = 'PFA-NAME';
|
||||
@ -204,10 +204,10 @@ class PeppolTest extends TestCase
|
||||
$pfa->FinancialInstitutionBranch = $fib;
|
||||
|
||||
$pm = new PaymentMeans();
|
||||
$pm->PayeeFinancialAccount = $pfa;
|
||||
$pm->PayeeFinancialAccount = $pfa;
|
||||
$einvoice->PaymentMeans[] = $pm;
|
||||
|
||||
|
||||
|
||||
$stub = new \stdClass();
|
||||
$stub->Invoice = $einvoice;
|
||||
|
||||
@ -240,7 +240,7 @@ class PeppolTest extends TestCase
|
||||
'settings' => $client_settings,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$item = new InvoiceItem();
|
||||
$item->product_key = "Product Key";
|
||||
$item->notes = "Product Description";
|
||||
@ -315,7 +315,7 @@ class PeppolTest extends TestCase
|
||||
'account_id' => $this->account->id,
|
||||
'settings' => $settings,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$cu = CompanyUserFactory::create($this->user->id, $company->id, $this->account->id);
|
||||
$cu->is_owner = true;
|
||||
@ -384,7 +384,7 @@ class PeppolTest extends TestCase
|
||||
$json = $e->encode($fe, 'json');
|
||||
$this->assertNotNull($json);
|
||||
|
||||
|
||||
|
||||
$decode = $e->decode('Peppol', $json, 'json');
|
||||
|
||||
$this->assertInstanceOf(\InvoiceNinja\EInvoice\Models\Peppol\Invoice::class, $decode);
|
||||
|
@ -31,7 +31,7 @@ class EntityPaidToDateTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -33,8 +33,8 @@ class ExpenseApiTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -78,7 +78,7 @@ class ExpenseApiTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson('/api/v1/expenses/'.$arr['data']['id'], $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
|
||||
@ -89,8 +89,8 @@ class ExpenseApiTest extends TestCase
|
||||
|
||||
public function testExpensePutWithVendorStatus()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
$data =
|
||||
[
|
||||
'vendor_id' => $this->vendor->hashed_id,
|
||||
@ -105,7 +105,7 @@ class ExpenseApiTest extends TestCase
|
||||
|
||||
$arr = $response->json();
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
$this->assertEquals($this->vendor->hashed_id, $arr['data']['vendor_id']);
|
||||
|
||||
@ -144,7 +144,7 @@ class ExpenseApiTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'transaction_id' => $bt->id,
|
||||
]);
|
||||
|
||||
|
||||
$this->assertNotNull($e->transaction_id);
|
||||
|
||||
$expense_repo = app('App\Repositories\ExpenseRepository');
|
||||
@ -343,7 +343,7 @@ class ExpenseApiTest extends TestCase
|
||||
])->post('/api/v1/expenses/bulk', $data);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertEquals($ec->hashed_id, $arr['data'][0]['category_id']);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
@ -28,7 +28,7 @@ class ExpenseCategoryApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ArDetailReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ArSummaryReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ClientBalanceReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -24,7 +24,7 @@ class ClientCsvTest extends TestCase
|
||||
use MakesHash;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ClientSalesReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -27,7 +27,7 @@ class ExportCsvTest extends TestCase
|
||||
use MakesHash;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -36,7 +36,7 @@ class ProductSalesReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class ProfitAndLossReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -23,10 +23,10 @@ class ReportApiTest extends TestCase
|
||||
{
|
||||
use MakesHash;
|
||||
use MockAccountData;
|
||||
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -53,7 +53,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
|
||||
Invoice::withTrashed()->cursor()->each(function ($i) { $i->forceDelete();});
|
||||
|
||||
$this->buildData();
|
||||
@ -225,7 +225,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
$this->token = \Illuminate\Support\Str::random(64);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $this->user->id;
|
||||
$company_token->company_id = $this->company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -270,12 +270,12 @@ class ReportCsvGenerationTest extends TestCase
|
||||
{
|
||||
Invoice::factory()->count(5)->create(
|
||||
[
|
||||
'client_id'=> $this->client->id,
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$data = [
|
||||
'date_range' => 'all',
|
||||
'report_keys' => ['invoice.number','client.name', 'contact.email'],
|
||||
@ -308,7 +308,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
$report_keys = ['invoice.number','client.name', 'invoice.amount'];
|
||||
$array = array_merge($report_keys, array_diff($forced, $report_keys));
|
||||
|
||||
|
||||
$this->assertEquals('client.name', $array[1]);
|
||||
|
||||
$report_keys = ['invoice.number','invoice.amount'];
|
||||
@ -325,7 +325,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post(config('ninja.app_url')."/api/v1/exports/preview/{$hash}");
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$item->product_key = 'batman';
|
||||
|
||||
$line_items = [];
|
||||
|
||||
|
||||
$line_items[] = $item;
|
||||
$item = InvoiceItemFactory::create();
|
||||
$item->product_key = 'bob the builder';
|
||||
@ -395,7 +395,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$q->orWhereJsonContains('line_items', ['product_key' => $product]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$this->assertEquals(1, $query->count());
|
||||
|
||||
$query = Invoice::query();
|
||||
@ -433,9 +433,9 @@ class ReportCsvGenerationTest extends TestCase
|
||||
);
|
||||
|
||||
$this->assertEquals(1, $q->count());
|
||||
|
||||
|
||||
$q->forceDelete();
|
||||
|
||||
|
||||
Invoice::factory()->create(
|
||||
[
|
||||
'company_id' => $this->company->id,
|
||||
@ -480,7 +480,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testVendorCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
$vendor =
|
||||
\App\Models\Vendor::factory()->create(
|
||||
[
|
||||
@ -509,7 +509,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/vendors', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -517,7 +517,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals('Vendor 1', $this->getFirstValueByColumn($csv, 'Vendor Name'));
|
||||
@ -545,7 +545,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$data = $export->returnJson();
|
||||
|
||||
$this->assertNotNull($data);
|
||||
|
||||
|
||||
$this->assertEquals('Vendor Name', $this->traverseJson($data, 'columns.9.display_value'));
|
||||
$this->assertEquals('vendor', $this->traverseJson($data, '0.0.entity'));
|
||||
$this->assertEquals('address1', $this->traverseJson($data, '0.0.id'));
|
||||
@ -557,7 +557,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testVendorCustomColumnCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\Vendor::query()->cursor()->each(function ($t) {
|
||||
$t->forceDelete();
|
||||
});
|
||||
@ -591,7 +591,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/vendors', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -599,7 +599,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -683,7 +683,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/tasks', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -691,10 +691,10 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
// nlog($csv);
|
||||
// nlog($csv);
|
||||
$this->assertEquals(3600, $this->getFirstValueByColumn($csv, 'Task Duration'));
|
||||
$this->assertEquals('test1', $this->getFirstValueByColumn($csv, 'Task Description'));
|
||||
$this->assertEquals('16/Jul/2023', $this->getFirstValueByColumn($csv, 'Task Start Date'));
|
||||
@ -752,7 +752,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -789,7 +789,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/tasks', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -797,7 +797,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals(3600, $this->getFirstValueByColumn($csv, 'Task Duration'));
|
||||
@ -838,7 +838,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/products', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -846,7 +846,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -920,7 +920,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/payments', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -928,7 +928,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
// nlog($csv);
|
||||
@ -940,7 +940,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$this->assertEquals('bob', $this->getFirstValueByColumn($csv, 'Client Name'));
|
||||
$this->assertEquals(0, $this->getFirstValueByColumn($csv, 'Client Balance'));
|
||||
$this->assertEquals(100, $this->getFirstValueByColumn($csv, 'Client Paid to Date'));
|
||||
|
||||
|
||||
$export = new PaymentExport($this->company, $data);
|
||||
$data = $export->returnJson();
|
||||
|
||||
@ -975,7 +975,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
])->post('/api/v1/reports/payments', $data)->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'date_range' => 'all',
|
||||
'report_keys' => array_merge(["payment.amount","payment.date"], $this->all_invoice_report_keys),
|
||||
@ -994,7 +994,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1023,7 +1023,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/payments', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1031,7 +1031,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1040,7 +1040,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$this->assertEquals(0, $this->getFirstValueByColumn($csv, 'Payment Refunded'));
|
||||
$this->assertEquals('2020-01-01', $this->getFirstValueByColumn($csv, 'Payment Date'));
|
||||
$this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Payment Transaction Reference'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1057,7 +1057,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/clients', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1065,12 +1065,12 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$reader = Reader::createFromString($csv);
|
||||
$reader->setHeaderOffset(0);
|
||||
|
||||
|
||||
$res = $reader->fetchColumnByName('Street');
|
||||
$res = iterator_to_array($res, true);
|
||||
|
||||
@ -1096,7 +1096,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/clients', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1104,7 +1104,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1163,7 +1163,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testCreditCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
Credit::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1189,7 +1189,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/credits', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
$hash = $arr['message'];
|
||||
@ -1221,7 +1221,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testInvoiceCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\Invoice::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1247,7 +1247,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
$hash = $arr['message'];
|
||||
@ -1282,10 +1282,10 @@ class ReportCsvGenerationTest extends TestCase
|
||||
])->post('/api/v1/reports/invoices', $data)->assertStatus(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testRecurringInvoiceCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\RecurringInvoice::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1312,7 +1312,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/recurring_invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
$arr = $response->json();
|
||||
$hash = $arr['message'];
|
||||
@ -1340,7 +1340,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testRecurringInvoiceColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\RecurringInvoice::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1367,7 +1367,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/recurring_invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1375,7 +1375,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Recurring Invoice Invoice Number'));
|
||||
@ -1387,7 +1387,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testInvoiceItemsCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\Invoice::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1431,7 +1431,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/invoice_items', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1495,7 +1495,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testQuoteItemsCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
$q = \App\Models\Quote::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1539,7 +1539,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/quote_items', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1547,7 +1547,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1625,7 +1625,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals('100', $this->getFirstValueByColumn($csv, 'Purchase Order Amount'));
|
||||
@ -1640,7 +1640,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testPurchaseOrderItemsCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
$vendor =
|
||||
\App\Models\Vendor::factory()->create(
|
||||
[
|
||||
@ -1695,7 +1695,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/purchase_order_items', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1703,7 +1703,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1723,7 +1723,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
|
||||
public function testQuoteCustomColumnsCsvGeneration()
|
||||
{
|
||||
|
||||
|
||||
\App\Models\Quote::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -1749,7 +1749,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/quotes', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1757,7 +1757,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -1813,7 +1813,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1821,7 +1821,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals('bob', $this->getFirstValueByColumn($csv, 'Client Name'));
|
||||
@ -1844,7 +1844,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/reports/contacts', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -1852,13 +1852,13 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
$reader = Reader::createFromString($csv);
|
||||
$reader->setHeaderOffset(0);
|
||||
|
||||
|
||||
$res = $reader->fetchColumnByName('Contact First Name');
|
||||
$res = iterator_to_array($res, true);
|
||||
|
||||
@ -1887,7 +1887,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
{
|
||||
$reader = Reader::createFromString($csv);
|
||||
$reader->setHeaderOffset(0);
|
||||
|
||||
|
||||
$res = $reader->fetchColumnByName($column);
|
||||
$res = iterator_to_array($res, true);
|
||||
|
||||
@ -1931,7 +1931,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -2025,7 +2025,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -2107,7 +2107,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
|
||||
@ -2190,7 +2190,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$hash = $arr['message'];
|
||||
|
||||
$response = $this->poll($hash);
|
||||
|
||||
|
||||
$csv = $response->body();
|
||||
|
||||
$this->assertEquals('100', $this->getFirstValueByColumn($csv, 'Quote Amount'));
|
||||
@ -2251,7 +2251,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$this->assertEquals('Public', $this->getFirstValueByColumn($csv, 'Expense Public Notes'));
|
||||
$this->assertEquals('Private', $this->getFirstValueByColumn($csv, 'Expense Private Notes'));
|
||||
$this->assertEquals($this->user->present()->name(), $this->getFirstValueByColumn($csv, 'Expense User'));
|
||||
|
||||
|
||||
$data = [
|
||||
'date_range' => 'all',
|
||||
'report_keys' => $this->all_client_report_keys,
|
||||
@ -2314,7 +2314,7 @@ class ReportCsvGenerationTest extends TestCase
|
||||
$this->assertEquals('Vendor 1', $this->getFirstValueByColumn($csv, 'Vendor Name'));
|
||||
$this->assertEquals('100', $this->getFirstValueByColumn($csv, 'Expense Amount'));
|
||||
$this->assertEquals('USD', $this->getFirstValueByColumn($csv, 'Expense Currency'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ class ReportPreviewTest extends TestCase
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -97,7 +97,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -129,7 +129,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'vendor_id' => $this->vendor->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -150,7 +150,7 @@ class ReportPreviewTest extends TestCase
|
||||
$r = Cache::pull('123');
|
||||
|
||||
$this->assertNotNull($r);
|
||||
|
||||
|
||||
//nlog($r);
|
||||
|
||||
}
|
||||
@ -162,7 +162,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -183,7 +183,7 @@ class ReportPreviewTest extends TestCase
|
||||
$r = Cache::pull('123');
|
||||
|
||||
$this->assertNotNull($r);
|
||||
|
||||
|
||||
//nlog($r);
|
||||
|
||||
}
|
||||
@ -196,7 +196,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -217,7 +217,7 @@ class ReportPreviewTest extends TestCase
|
||||
$r = Cache::pull('123');
|
||||
|
||||
$this->assertNotNull($r);
|
||||
|
||||
|
||||
//nlog($r);
|
||||
|
||||
}
|
||||
@ -231,7 +231,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'vendor_id' => $this->vendor->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -262,7 +262,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -293,7 +293,7 @@ class ReportPreviewTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -323,7 +323,7 @@ class ReportPreviewTest extends TestCase
|
||||
'company_id' => $this->company->id,
|
||||
'user_id' => $this->user->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -355,7 +355,7 @@ class ReportPreviewTest extends TestCase
|
||||
'documentable_type' => Client::class,
|
||||
'documentable_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -476,7 +476,7 @@ class ReportPreviewTest extends TestCase
|
||||
|
||||
public function testCreditExportPreview()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'send_email' => false,
|
||||
'date_range' => 'all',
|
||||
@ -491,7 +491,7 @@ class ReportPreviewTest extends TestCase
|
||||
$r = Cache::pull('123');
|
||||
|
||||
$this->assertNotNull($r);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testCreditPreview()
|
||||
@ -509,6 +509,6 @@ class ReportPreviewTest extends TestCase
|
||||
])->postJson('/api/v1/reports/credits?output=json', $data)
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class TaxSummaryReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class UserSalesReportTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -25,7 +25,7 @@ class FilterApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -97,7 +97,7 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
||||
];
|
||||
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -125,8 +125,8 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
||||
|
||||
public function testInvoiceDelayedNotificationPayment()
|
||||
{
|
||||
$gocardlesspayment = new \stdClass;
|
||||
$links = new \stdClass;
|
||||
$gocardlesspayment = new \stdClass();
|
||||
$links = new \stdClass();
|
||||
$links->mandate = "my_mandate";
|
||||
$gocardlesspayment->links = $links;
|
||||
$gocardlesspayment->id = "gocardless_payment_id";
|
||||
@ -172,7 +172,7 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
||||
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
|
||||
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'b9886f9257f0c6ee7c302f1c74475f6c';
|
||||
|
@ -41,7 +41,7 @@ class GroupSettingTest extends TestCase
|
||||
public function testCastingMagic()
|
||||
{
|
||||
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
$settings->tax_name1 = '';
|
||||
$settings->tax_rate1 = 0;
|
||||
@ -51,7 +51,7 @@ class GroupSettingTest extends TestCase
|
||||
$this->assertEquals("", $settings->tax_name1);
|
||||
$settings = null;
|
||||
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
$settings->tax_name1 = "1";
|
||||
$settings->tax_rate1 = 0;
|
||||
@ -63,7 +63,7 @@ class GroupSettingTest extends TestCase
|
||||
$settings = $s->cast($settings)->toArray();
|
||||
$this->assertEquals("1", $settings['tax_name1']);
|
||||
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
$settings->tax_name1 = [];
|
||||
$settings->tax_rate1 = 0;
|
||||
@ -75,9 +75,9 @@ class GroupSettingTest extends TestCase
|
||||
$settings = $s->cast($settings)->toArray();
|
||||
$this->assertEquals("", $settings['tax_name1']);
|
||||
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
$settings->tax_name1 = new \stdClass;
|
||||
$settings->tax_name1 = new \stdClass();
|
||||
$settings->tax_rate1 = 0;
|
||||
|
||||
$settings = $s->cast($settings)->toObject();
|
||||
@ -94,7 +94,7 @@ class GroupSettingTest extends TestCase
|
||||
|
||||
public function testTaxNameInGroupFilters()
|
||||
{
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
$settings->tax_name1 = '';
|
||||
$settings->tax_rate1 = 0;
|
||||
@ -110,17 +110,17 @@ class GroupSettingTest extends TestCase
|
||||
])->postJson('/api/v1/group_settings', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals("", (string)null);
|
||||
$this->assertNotNull($arr['data']['settings']['tax_name1']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddGroupFilters()
|
||||
{
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
|
||||
$data = [
|
||||
@ -156,7 +156,7 @@ class GroupSettingTest extends TestCase
|
||||
|
||||
public function testAddGroupSettings()
|
||||
{
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
|
||||
$data = [
|
||||
@ -179,7 +179,7 @@ class GroupSettingTest extends TestCase
|
||||
|
||||
public function testArchiveGroupSettings()
|
||||
{
|
||||
$settings = new \stdClass;
|
||||
$settings = new \stdClass();
|
||||
$settings->currency_id = '1';
|
||||
|
||||
$data = [
|
||||
|
@ -27,11 +27,12 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
|
||||
private $mock;
|
||||
private $state;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
||||
parent::setUp();
|
||||
|
||||
|
||||
$this->markTestSkipped("no bueno");
|
||||
|
||||
$this->state = Str::random(4);
|
||||
@ -45,7 +46,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
|
||||
public function testAuthorize(): void
|
||||
{
|
||||
|
||||
|
||||
$this->mock->shouldReceive('getState')->andReturn($this->state);
|
||||
$this->mock->shouldReceive('getAuthorizationCodeURL')->andReturn('https://example.com');
|
||||
$this->mock->shouldReceive("getOAuth2LoginHelper")->andReturn($this->mock);
|
||||
@ -53,7 +54,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
Cache::spy();
|
||||
Cache::shouldReceive('get')
|
||||
->with($token = $this->company->company_key)
|
||||
->andReturn( ['company_key' => $token, 'id' => $this->company->id]);
|
||||
->andReturn(['company_key' => $token, 'id' => $this->company->id]);
|
||||
Cache::shouldReceive('has')
|
||||
->andReturn(true);
|
||||
// Perform the test
|
||||
@ -67,7 +68,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
{
|
||||
$token = ['company_key' => $this->company->company_key, 'id' => $this->company->id] ;
|
||||
|
||||
$this->mock->shouldReceive('getAccessToken')->andReturn(Mockery::mock(stdClass::class,function(MockInterface $mock){
|
||||
$this->mock->shouldReceive('getAccessToken')->andReturn(Mockery::mock(stdClass::class, function (MockInterface $mock) {
|
||||
$mock->shouldReceive('getAccessToken')->andReturn('abcdefg');
|
||||
$mock->shouldReceive('getRefreshToken')->andReturn('abcdefghi');
|
||||
$mock->shouldReceive('getAccessTokenExpiresAt')->andReturn(3600);
|
||||
@ -75,7 +76,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
}));
|
||||
$this->mock->shouldReceive("getOAuth2LoginHelper")->andReturn($this->mock);
|
||||
$this->mock->shouldReceive('exchangeAuthorizationCodeForToken')->once();
|
||||
|
||||
|
||||
Cache::spy();
|
||||
Cache::shouldReceive('has')
|
||||
->andReturn(true);
|
||||
@ -87,29 +88,29 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
|
||||
Cache::shouldHaveReceived('put')->once()->with($token['company_key'], 'abcdefg', 3600);
|
||||
|
||||
$this->mock->shouldHaveReceived('exchangeAuthorizationCodeForToken')->once()->with(123456,12345678);
|
||||
$this->mock->shouldHaveReceived('exchangeAuthorizationCodeForToken')->once()->with(123456, 12345678);
|
||||
}
|
||||
|
||||
public function testImport(): void
|
||||
{
|
||||
// Cache::spy();
|
||||
// Cache::spy();
|
||||
//Bus::fake();
|
||||
$data = $this->setUpTestData('customers');
|
||||
$count = count($data);
|
||||
$this->mock->shouldReceive('Query')->andReturnUsing(
|
||||
function($val, $s = 1, $max = 1000) use ($count, $data) {
|
||||
if(stristr($val, 'count')) {
|
||||
return $count;
|
||||
}
|
||||
|
||||
return Arr::take($data,$max);
|
||||
function ($val, $s = 1, $max = 1000) use ($count, $data) {
|
||||
if(stristr($val, 'count')) {
|
||||
return $count;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return Arr::take($data, $max);
|
||||
}
|
||||
);
|
||||
|
||||
// Perform the test
|
||||
$response = $this->actingAs($this->user)->withHeaders([
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/import/quickbooks',[
|
||||
])->post('/api/v1/import/quickbooks', [
|
||||
'import_types' => ['client']
|
||||
]);
|
||||
$response->assertStatus(200);
|
||||
@ -118,11 +119,13 @@ class ImportQuickbooksControllerTest extends TestCase
|
||||
//Bus::assertDispatched(\App\Jobs\Import\QuickbooksIngest::class);
|
||||
}
|
||||
|
||||
protected function setUpTestData($file) {
|
||||
protected function setUpTestData($file)
|
||||
{
|
||||
$data = json_decode(
|
||||
file_get_contents(base_path("tests/Mock/Quickbooks/Data/$file.json")),true
|
||||
file_get_contents(base_path("tests/Mock/Quickbooks/Data/$file.json")),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class BaseTransformerTest extends TestCase
|
||||
use MakesHash;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -92,7 +92,7 @@ class TaskImportTest extends TestCase
|
||||
$task = Task::where('company_id', $this->company->id)->where('number', 'x1234')->first();
|
||||
$this->assertNotNull($task);
|
||||
$this->assertEquals(1998, $task->calcDuration());
|
||||
|
||||
|
||||
$time_log = json_decode($task->time_log);
|
||||
|
||||
foreach($time_log as $log) {
|
||||
@ -109,7 +109,7 @@ class TaskImportTest extends TestCase
|
||||
$this->assertTrue($log[3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ class TaskImportTest extends TestCase
|
||||
Task::query()
|
||||
->where('company_id', $this->company->id)
|
||||
->forceDelete();
|
||||
|
||||
|
||||
$this->assertEquals(0, Task::withTrashed()->where('company_id', $this->company->id)->count());
|
||||
|
||||
/*Need to import clients first*/
|
||||
|
@ -68,12 +68,12 @@ class ImportCompanyTest extends TestCase
|
||||
|
||||
public $ids;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Artisan::call('db:seed');
|
||||
|
||||
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
@ -93,7 +93,7 @@ class ImportCompanyTest extends TestCase
|
||||
|
||||
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
$zip = new \ZipArchive();
|
||||
$res = $zip->open($backup_json_file_zip);
|
||||
if ($res === true) {
|
||||
$zip->extractTo(sys_get_temp_dir());
|
||||
@ -117,7 +117,7 @@ class ImportCompanyTest extends TestCase
|
||||
{
|
||||
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||
|
||||
$zip = new \ZipArchive;
|
||||
$zip = new \ZipArchive();
|
||||
$res = $zip->open($backup_json_file_zip);
|
||||
|
||||
if ($res === true) {
|
||||
@ -423,7 +423,7 @@ class ImportCompanyTest extends TestCase
|
||||
$this->genericImport(
|
||||
Vendor::class,
|
||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'],
|
||||
[['users' => 'user_id'], ['users' =>'assigned_user_id']],
|
||||
[['users' => 'user_id'], ['users' => 'assigned_user_id']],
|
||||
'vendors',
|
||||
'number'
|
||||
);
|
||||
@ -437,7 +437,7 @@ class ImportCompanyTest extends TestCase
|
||||
$this->genericImport(
|
||||
Project::class,
|
||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'client_id'],
|
||||
[['users' => 'user_id'], ['users' =>'assigned_user_id'], ['clients' => 'client_id']],
|
||||
[['users' => 'user_id'], ['users' => 'assigned_user_id'], ['clients' => 'client_id']],
|
||||
'projects',
|
||||
'number'
|
||||
);
|
||||
@ -453,7 +453,7 @@ class ImportCompanyTest extends TestCase
|
||||
$this->genericNewClassImport(
|
||||
Product::class,
|
||||
['user_id', 'company_id', 'hashed_id', 'id'],
|
||||
[['users' => 'user_id'], ['users' =>'assigned_user_id'], ['vendors' => 'vendor_id'], ['projects' => 'project_id']],
|
||||
[['users' => 'user_id'], ['users' => 'assigned_user_id'], ['vendors' => 'vendor_id'], ['projects' => 'project_id']],
|
||||
'products'
|
||||
);
|
||||
$this->assertEquals(1, Product::count());
|
||||
@ -1149,7 +1149,7 @@ class ImportCompanyTest extends TestCase
|
||||
return $this->ids[$resource]["{$old}"];
|
||||
}
|
||||
|
||||
protected function tearDown() :void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$backup_json_file = sys_get_temp_dir().'/backup/backup.json';
|
||||
|
||||
|
@ -155,7 +155,7 @@ class InvoicelyTest extends TestCase
|
||||
|
||||
$base_transformer = new BaseTransformer($this->company);
|
||||
|
||||
|
||||
|
||||
$this->assertTrue($base_transformer->hasInvoice('INV-1'));
|
||||
|
||||
$invoice_id = $base_transformer->getInvoiceId('INV-1');
|
||||
|
@ -18,7 +18,6 @@ use Illuminate\Support\Str;
|
||||
use ReflectionClass;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
||||
class QuickbooksTest extends TestCase
|
||||
{
|
||||
use MakesHash;
|
||||
@ -31,24 +30,24 @@ class QuickbooksTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
$this->markTestSkipped("NO BUENO");
|
||||
$this->withoutMiddleware(ThrottleRequests::class);
|
||||
config(['database.default' => config('ninja.db.default')]);
|
||||
$this->makeTestData();
|
||||
//
|
||||
//
|
||||
$this->withoutExceptionHandling();
|
||||
Auth::setUser($this->user);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testImportCallsGetDataOnceForClient()
|
||||
{
|
||||
$data = (json_decode( file_get_contents( base_path('tests/Feature/Import/customers.json') ), true))['Customer'];
|
||||
$data = (json_decode(file_get_contents(base_path('tests/Feature/Import/customers.json')), true))['Customer'];
|
||||
$hash = Str::random(32);
|
||||
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
||||
|
||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
||||
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||
'hash' => $hash,
|
||||
'column_map' => ['client' => ['mapping' => []]],
|
||||
'skip_header' => true,
|
||||
@ -60,7 +59,7 @@ class QuickbooksTest extends TestCase
|
||||
->andReturn($data);
|
||||
|
||||
// Mocking the dependencies used within the client method
|
||||
|
||||
|
||||
$quickbooks->import('client');
|
||||
|
||||
$this->assertArrayHasKey('clients', $quickbooks->entity_count);
|
||||
@ -68,19 +67,19 @@ class QuickbooksTest extends TestCase
|
||||
|
||||
$base_transformer = new BaseTransformer($this->company);
|
||||
$this->assertTrue($base_transformer->hasClient('Sonnenschein Family Store'));
|
||||
$contact = $base_transformer->getClient('Amy\'s Bird Sanctuary','');
|
||||
$contact = Client::where('name','Amy\'s Bird Sanctuary')->first();
|
||||
$this->assertEquals('(650) 555-3311',$contact->phone);
|
||||
$this->assertEquals('Birds@Intuit.com',$contact->contacts()->first()->email);
|
||||
$contact = $base_transformer->getClient('Amy\'s Bird Sanctuary', '');
|
||||
$contact = Client::where('name', 'Amy\'s Bird Sanctuary')->first();
|
||||
$this->assertEquals('(650) 555-3311', $contact->phone);
|
||||
$this->assertEquals('Birds@Intuit.com', $contact->contacts()->first()->email);
|
||||
}
|
||||
|
||||
public function testImportCallsGetDataOnceForProducts()
|
||||
{
|
||||
$data = (json_decode( file_get_contents( base_path('tests/Feature/Import/items.json') ), true))['Item'];
|
||||
$data = (json_decode(file_get_contents(base_path('tests/Feature/Import/items.json')), true))['Item'];
|
||||
$hash = Str::random(32);
|
||||
Cache::put($hash.'-item', base64_encode(json_encode($data)), 360);
|
||||
|
||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
||||
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||
'hash' => $hash,
|
||||
'column_map' => ['item' => ['mapping' => []]],
|
||||
'skip_header' => true,
|
||||
@ -92,7 +91,7 @@ class QuickbooksTest extends TestCase
|
||||
->andReturn($data);
|
||||
|
||||
// Mocking the dependencies used within the client method
|
||||
|
||||
|
||||
$quickbooks->import('product');
|
||||
|
||||
$this->assertArrayHasKey('products', $quickbooks->entity_count);
|
||||
@ -100,17 +99,17 @@ class QuickbooksTest extends TestCase
|
||||
|
||||
$base_transformer = new BaseTransformer($this->company);
|
||||
$this->assertTrue($base_transformer->hasProduct('Gardening'));
|
||||
$product = Product::where('product_key','Pest Control')->first();
|
||||
$this->assertGreaterThanOrEqual( 35, $product->price);
|
||||
$product = Product::where('product_key', 'Pest Control')->first();
|
||||
$this->assertGreaterThanOrEqual(35, $product->price);
|
||||
$this->assertLessThanOrEqual(0, $product->quantity);
|
||||
}
|
||||
|
||||
public function testImportCallsGetDataOnceForInvoices()
|
||||
{
|
||||
$data = (json_decode( file_get_contents( base_path('tests/Feature/Import/invoices.json') ), true))['Invoice'];
|
||||
$data = (json_decode(file_get_contents(base_path('tests/Feature/Import/invoices.json')), true))['Invoice'];
|
||||
$hash = Str::random(32);
|
||||
Cache::put($hash.'-invoice', base64_encode(json_encode($data)), 360);
|
||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
||||
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||
'hash' => $hash,
|
||||
'column_map' => ['invoice' => ['mapping' => []]],
|
||||
'skip_header' => true,
|
||||
@ -125,10 +124,10 @@ class QuickbooksTest extends TestCase
|
||||
$this->assertGreaterThan(0, $quickbooks->entity_count['invoices']);
|
||||
$base_transformer = new BaseTransformer($this->company);
|
||||
$this->assertTrue($base_transformer->hasInvoice(1007));
|
||||
$invoice = Invoice::where('number',1012)->first();
|
||||
$data = collect($data)->where('DocNumber','1012')->first();
|
||||
$this->assertGreaterThanOrEqual( $data['TotalAmt'], $invoice->amount);
|
||||
$this->assertEquals( count($data['Line']) - 1 , count((array)$invoice->line_items));
|
||||
$invoice = Invoice::where('number', 1012)->first();
|
||||
$data = collect($data)->where('DocNumber', '1012')->first();
|
||||
$this->assertGreaterThanOrEqual($data['TotalAmt'], $invoice->amount);
|
||||
$this->assertEquals(count($data['Line']) - 1, count((array)$invoice->line_items));
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ class InventoryManagementTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -62,7 +62,7 @@ class InventoryManagementTest extends TestCase
|
||||
$invoice->company->track_inventory = true;
|
||||
$invoice->push();
|
||||
|
||||
$invoice_item = new InvoiceItem;
|
||||
$invoice_item = new InvoiceItem();
|
||||
$invoice_item->type_id = 1;
|
||||
$invoice_item->product_key = $product->product_key;
|
||||
$invoice_item->notes = $product->notes;
|
||||
@ -95,7 +95,7 @@ class InventoryManagementTest extends TestCase
|
||||
$invoice->service()->markDeleted()->save();
|
||||
$invoice->is_deleted = true;
|
||||
$invoice->save();
|
||||
|
||||
|
||||
$this->assertEquals(100, $product->fresh()->in_stock_quantity);
|
||||
|
||||
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($data['data']['id']));
|
||||
|
@ -35,7 +35,7 @@ class InvitationTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
// use RefreshDatabase;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -27,7 +27,7 @@ class InvoiceAmountPaymentTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class InvoiceEmailTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -56,7 +56,7 @@ class InvoiceEmailTest extends TestCase
|
||||
|
||||
$this->assertTrue(strpos($email, '@example.com') !== false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testClientEmailHistory()
|
||||
{
|
||||
@ -83,7 +83,7 @@ class InvoiceEmailTest extends TestCase
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$system_log->save();
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ class InvoiceEmailTest extends TestCase
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$system_log->save();
|
||||
|
||||
$data = [
|
||||
@ -166,18 +166,18 @@ class InvoiceEmailTest extends TestCase
|
||||
$data = [
|
||||
"body" => "hey what's up",
|
||||
"entity" => 'invoice',
|
||||
"entity_id"=> $this->invoice->hashed_id,
|
||||
"subject"=> 'Reminder $number',
|
||||
"template"=> "first_custom"
|
||||
"entity_id" => $this->invoice->hashed_id,
|
||||
"subject" => 'Reminder $number',
|
||||
"template" => "first_custom"
|
||||
];
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/emails', $data);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/emails', $data);
|
||||
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
@ -194,10 +194,10 @@ class InvoiceEmailTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/emails', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/emails', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -256,7 +256,7 @@ class InvoiceEmailTest extends TestCase
|
||||
if ($invitation->contact->send_email && $invitation->contact->email) {
|
||||
EmailEntity::dispatch($invitation, $invitation->company);
|
||||
|
||||
|
||||
|
||||
Bus::assertDispatched(EmailEntity::class);
|
||||
|
||||
}
|
||||
@ -287,7 +287,7 @@ class InvoiceEmailTest extends TestCase
|
||||
if ($invitation->contact->send_email && $invitation->contact->email) {
|
||||
EmailEntity::dispatch($invitation, $invitation->company);
|
||||
|
||||
|
||||
|
||||
Bus::assertDispatched(EmailEntity::class);
|
||||
|
||||
}
|
||||
@ -313,7 +313,7 @@ class InvoiceEmailTest extends TestCase
|
||||
if ($invitation->contact->send_email && $invitation->contact->email) {
|
||||
EmailEntity::dispatch($invitation, $invitation->company);
|
||||
|
||||
|
||||
|
||||
Bus::assertDispatched(EmailEntity::class);
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class InvoiceLinkTasksTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -39,7 +39,7 @@ class InvoiceTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -84,7 +84,7 @@ class InvoiceTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/invoices?mark_sent=true',$data)
|
||||
])->postJson('/api/v1/invoices?mark_sent=true', $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -212,7 +212,7 @@ class InvoiceTest extends TestCase
|
||||
'company_id' => $this->company->id,
|
||||
'client_id' => $this->client->id,
|
||||
]);
|
||||
|
||||
|
||||
$invoice = [
|
||||
'status_id' => 1,
|
||||
'number' => 'dfdfd',
|
||||
@ -298,7 +298,7 @@ class InvoiceTest extends TestCase
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->get('/api/v1/invoices?date_range=1971-01-01,1971-01-03', )
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertCount(10, $arr['data']);
|
||||
|
@ -31,15 +31,15 @@ class QuickbooksIngestTest extends TestCase
|
||||
$this->makeTestData();
|
||||
$this->withoutExceptionHandling();
|
||||
Auth::setUser($this->user);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*/
|
||||
public function testCanQuickbooksIngest(): void
|
||||
{
|
||||
$data = (json_decode( file_get_contents( base_path('tests/Feature/Import/customers.json') ), true))['Customer'];
|
||||
$data = (json_decode(file_get_contents(base_path('tests/Feature/Import/customers.json')), true))['Customer'];
|
||||
$hash = Str::random(32);
|
||||
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
||||
QuickbooksIngest::dispatch([
|
||||
@ -47,7 +47,7 @@ class QuickbooksIngestTest extends TestCase
|
||||
'column_map' => ['client' => ['mapping' => []]],
|
||||
'skip_header' => true,
|
||||
'import_types' => ['client'],
|
||||
], $this->company )->handle();
|
||||
], $this->company)->handle();
|
||||
$this->assertTrue(Client::withTrashed()->where(['company_id' => $this->company->id, 'name' => "Freeman Sporting Goods"])->exists());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class LiveDesignTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -37,7 +37,7 @@ class LiveDesignTest extends TestCase
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
if (config('ninja.testvars.travis') !== false) {
|
||||
$this->markTestSkipped('Skip test for Travis');
|
||||
}
|
||||
@ -59,7 +59,7 @@ class LiveDesignTest extends TestCase
|
||||
$engine = new HtmlEngine($ii);
|
||||
|
||||
$this->assertNotNull($engine);
|
||||
|
||||
|
||||
$data = $engine->generateLabelsAndValues();
|
||||
|
||||
$this->assertIsArray($data);
|
||||
@ -87,7 +87,7 @@ class LiveDesignTest extends TestCase
|
||||
|
||||
$d = Design::find(1);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'entity_type' => 'invoice',
|
||||
'settings_type' => 'company',
|
||||
@ -99,7 +99,7 @@ class LiveDesignTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/live_design/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class LoadTest extends TestCase
|
||||
|
||||
public int $count = 1;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -74,7 +74,7 @@ class LoadTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
|
@ -29,7 +29,7 @@ class LoginTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Session::start();
|
||||
@ -155,7 +155,7 @@ class LoginTest extends TestCase
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
@ -187,9 +187,9 @@ class LoginTest extends TestCase
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
])->postJson('/api/v1/login', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
])->postJson('/api/v1/login', $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
@ -32,7 +32,7 @@ class MaxAmountTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -41,7 +41,7 @@ class MaxAmountTest extends TestCase
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testInvoiceMaxAmount()
|
||||
@ -65,7 +65,7 @@ class MaxAmountTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
$i = Invoice::factory()->create($data);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -96,7 +96,7 @@ class MaxAmountTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
$i = Credit::factory()->create($data);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -127,7 +127,7 @@ class MaxAmountTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
$i = Quote::factory()->create($data);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -136,7 +136,7 @@ class MaxAmountTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
}
|
||||
|
||||
public function testPurchaseOrderMaxAmount()
|
||||
public function testPurchaseOrderMaxAmount()
|
||||
{
|
||||
$item = new InvoiceItem();
|
||||
$item->cost = 10000000000000000;
|
||||
@ -157,7 +157,7 @@ public function testPurchaseOrderMaxAmount()
|
||||
$response->assertStatus(422);
|
||||
|
||||
$i = PurchaseOrder::factory()->create($data);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -188,7 +188,7 @@ public function testPurchaseOrderMaxAmount()
|
||||
$response->assertStatus(422);
|
||||
|
||||
$i = RecurringInvoice::factory()->create($data);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
|
@ -29,7 +29,7 @@ class MigrationTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -31,11 +31,12 @@ use Tests\TestCase;
|
||||
*/
|
||||
class MultiPaymentDeleteTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions, MakesHash;
|
||||
use DatabaseTransactions;
|
||||
use MakesHash;
|
||||
|
||||
private $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -63,7 +64,7 @@ class MultiPaymentDeleteTest extends TestCase
|
||||
$cu->is_admin = true;
|
||||
$cu->save();
|
||||
|
||||
$token = new CompanyToken;
|
||||
$token = new CompanyToken();
|
||||
$token->user_id = $user->id;
|
||||
$token->company_id = $company->id;
|
||||
$token->account_id = $account->id;
|
||||
|
@ -32,7 +32,7 @@ class PlanTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -92,8 +92,8 @@ class PlanTest extends TestCase
|
||||
public function testLicense()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
|
||||
$license = new License;
|
||||
|
||||
$license = new License();
|
||||
$license->license_key = "1234";
|
||||
$license->product_id = "3";
|
||||
$license->email = 'test@gmail.com';
|
||||
@ -104,9 +104,9 @@ class PlanTest extends TestCase
|
||||
|
||||
$response = $this->get("/claim_license?license_key=1234&product_id=3")
|
||||
->assertStatus(200);
|
||||
|
||||
|
||||
$response = $this->get("/claim_license?license_key=12345&product_id=3")
|
||||
->assertStatus(400);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,15 +34,15 @@ class NotificationTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class NotificationTest extends TestCase
|
||||
'confirmation_code' => uniqid("st", true),
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $u->id;
|
||||
$company_token->company_id = $this->company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -76,7 +76,7 @@ class NotificationTest extends TestCase
|
||||
|
||||
$company_user = CompanyUser::where('user_id', $u->id)->where('company_id', $this->company->id)->first();
|
||||
|
||||
$notifications = new \stdClass;
|
||||
$notifications = new \stdClass();
|
||||
$notifications->email = ["invoice_late_user","quote_approved_user"];
|
||||
$company_user->update(['notifications' => (array)$notifications]);
|
||||
|
||||
@ -106,7 +106,7 @@ class NotificationTest extends TestCase
|
||||
|
||||
public function testNotificationFound()
|
||||
{
|
||||
$notifications = new \stdClass;
|
||||
$notifications = new \stdClass();
|
||||
$notifications->email = ["inventory_all"];
|
||||
|
||||
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
|
||||
@ -130,7 +130,7 @@ class NotificationTest extends TestCase
|
||||
|
||||
public function testAllNotificationsFires()
|
||||
{
|
||||
$notifications = new \stdClass;
|
||||
$notifications = new \stdClass();
|
||||
$notifications->email = ["all_notifications"];
|
||||
|
||||
$p = Product::factory()->create([
|
||||
@ -146,7 +146,7 @@ class NotificationTest extends TestCase
|
||||
|
||||
public function testAllNotificationsFiresForUser()
|
||||
{
|
||||
$notifications = new \stdClass;
|
||||
$notifications = new \stdClass();
|
||||
$notifications->email = ["all_user_notifications"];
|
||||
|
||||
$p = Product::factory()->create([
|
||||
@ -168,7 +168,7 @@ class NotificationTest extends TestCase
|
||||
'confirmation_code' => uniqid("st", true),
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $u->id;
|
||||
$company_token->company_id = $this->company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -192,7 +192,7 @@ class NotificationTest extends TestCase
|
||||
]);
|
||||
|
||||
|
||||
$notifications = new \stdClass;
|
||||
$notifications = new \stdClass();
|
||||
$notifications->email = ["all_user_notifications"];
|
||||
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
|
||||
|
||||
@ -210,7 +210,7 @@ class NotificationTest extends TestCase
|
||||
$cu->save();
|
||||
|
||||
$methods = $this->findUserEntityNotificationType($p, $cu, ["all_notifications"]);
|
||||
|
||||
|
||||
$this->assertCount(1, $methods);
|
||||
|
||||
$notifications = [];
|
||||
|
@ -29,14 +29,14 @@ class WebhookTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
private $webhook_string = '{"id":"WH-8WP702374D398111T-81807959NA3371206","event_version":"1.0","create_time":"2023-12-13T08:36:03.961Z","resource_type":"checkout-order","resource_version":"2.0","event_type":"CHECKOUT.ORDER.COMPLETED","summary":"Checkout Order Completed","resource":{"update_time":"2023-12-13T08:35:27Z","create_time":"2023-12-13T08:35:18Z","purchase_units":[{"reference_id":"default","amount":{"currency_code":"USD","value":"1285.13","breakdown":{"item_total":{"currency_code":"USD","value":"1285.13"}}},"payee":{"merchant_id":"KDCGGYWFNWTAN"},"payment_instruction":{"disbursement_mode":"INSTANT"},"description":"Invoice Number# fq30028","custom_id":"xLqrlFTUHJONFhSDhSUZBp0ckeZnpdFq","invoice_id":"fq30028","soft_descriptor":"NOVEMBER 6","items":[{"name":"Invoice Number# fq30028","unit_amount":{"currency_code":"USD","value":"1285.13"},"quantity":"1","description":"Ut totam facilis.Ut totam facilis.Ut totam facilis."}],"shipping":{"name":{"full_name":"John Doe"},"address":{"address_line_1":"1 Main St","admin_area_2":"San Jose","admin_area_1":"CA","postal_code":"95131","country_code":"US"}},"payments":{"captures":[{"id":"40A1323403146010F","status":"COMPLETED","amount":{"currency_code":"USD","value":"1285.13"},"final_capture":true,"disbursement_mode":"INSTANT","seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"seller_receivable_breakdown":{"gross_amount":{"currency_code":"USD","value":"1285.13"},"paypal_fee":{"currency_code":"USD","value":"45.34"},"net_amount":{"currency_code":"USD","value":"1239.79"}},"invoice_id":"fq30028","custom_id":"xLqrlFTUHJONFhSDhSUZBp0ckeZnpdFq","links":[{"href":"https:\\/\\/api.sandbox.paypal.com\\/v2\\/payments\\/captures\\/40A1323403146010F","rel":"self","method":"GET"},{"href":"https:\\/\\/api.sandbox.paypal.com\\/v2\\/payments\\/captures\\/40A1323403146010F\\/refund","rel":"refund","method":"POST"},{"href":"https:\\/\\/api.sandbox.paypal.com\\/v2\\/checkout\\/orders\\/5WX67707S1265192L","rel":"up","method":"GET"}],"create_time":"2023-12-13T08:35:27Z","update_time":"2023-12-13T08:35:27Z"}]}}],"links":[{"href":"https:\\/\\/api.sandbox.paypal.com\\/v2\\/checkout\\/orders\\/5WX67707S1265192L","rel":"self","method":"GET"}],"id":"5WX67707S1265192L","payment_source":{"paypal":{"email_address":"sb-0kvkf26397832@personal.example.com","account_id":"4X5WHWAP5GQ3Y","account_status":"VERIFIED","name":{"given_name":"John","surname":"Doe"},"address":{"address_line_1":"62158","address_line_2":"341 Colton Canyon","admin_area_2":"Port Lisandro","admin_area_1":"New Jersey","postal_code":"08127","country_code":"GR"}}},"intent":"CAPTURE","payer":{"name":{"given_name":"John","surname":"Doe"},"email_address":"sb-0kvkf26397832@personal.example.com","payer_id":"4X5WHWAP5GQ3Y","address":{"address_line_1":"62158","address_line_2":"341 Colton Canyon","admin_area_2":"Port Lisandro","admin_area_1":"New Jersey","postal_code":"08127","country_code":"GR"}},"status":"COMPLETED"},"links":[{"href":"https:\\/\\/api.sandbox.paypal.com\\/v1\\/notifications\\/webhooks-events\\/WH-8WP702374D398111T-81807959NA3371206","rel":"self","method":"GET"},{"href":"https:\\/\\/api.sandbox.paypal.com\\/v1\\/notifications\\/webhooks-events\\/WH-8WP702374D398111T-81807959NA3371206\\/resend","rel":"resend","method":"POST"}],"q":"\\/api\\/v1\\/ppcp\\/webhook"}';
|
||||
|
||||
|
||||
private string $merchant_id = 'KDCGGYWFNWTAN';
|
||||
|
||||
private string $invoice_number = 'fq30028';
|
||||
|
||||
private float $amount = 1285.13;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -45,7 +45,7 @@ class WebhookTest extends TestCase
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testWebhooks()
|
||||
@ -82,7 +82,7 @@ class WebhookTest extends TestCase
|
||||
'is_recurring' => false,
|
||||
];
|
||||
|
||||
$payment_hash = new PaymentHash;
|
||||
$payment_hash = new PaymentHash();
|
||||
$payment_hash->hash = Str::random(32);
|
||||
$payment_hash->data = $hash_data;
|
||||
$payment_hash->fee_total = 0;
|
||||
@ -113,7 +113,7 @@ class WebhookTest extends TestCase
|
||||
|
||||
private function buildGateway()
|
||||
{
|
||||
$config = new \stdClass;
|
||||
$config = new \stdClass();
|
||||
$config->merchantId = $this->merchant_id;
|
||||
$config->status = 'activated';
|
||||
$config->consent = 'true';
|
||||
@ -122,7 +122,7 @@ class WebhookTest extends TestCase
|
||||
$config->returnMessage = 'true';
|
||||
$config->paymentsReceivable = 'Yes';
|
||||
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $this->company->id;
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = '80af24a6a691230bbec33e930ab40666';
|
||||
@ -133,12 +133,12 @@ class WebhookTest extends TestCase
|
||||
$cg->config = encrypt($config);
|
||||
$cg->save();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{3} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{3} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
|
||||
return $cg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class PaymentLinkTest extends TestCase
|
||||
|
||||
$price = $target->link_service()->calculateUpgradePriceV2($recurring_invoice, $target);
|
||||
|
||||
$refund = round($invoice->paid_to_date*$ratio,2);
|
||||
$refund = round($invoice->paid_to_date * $ratio, 2);
|
||||
|
||||
$this->assertEquals(($target->price - $refund), $price);
|
||||
|
||||
|
@ -31,7 +31,7 @@ class PaymentTermsApiTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -44,7 +44,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -64,7 +64,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testIdempotencyTrigger()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'amount' => 5,
|
||||
'client_id' => $this->client->hashed_id,
|
||||
@ -84,7 +84,7 @@ class PaymentTest extends TestCase
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
sleep(1);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
@ -99,7 +99,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testInvoicesValidationProp()
|
||||
{
|
||||
|
||||
|
||||
$data = [
|
||||
'amount' => 5,
|
||||
'client_id' => $this->client->hashed_id,
|
||||
@ -119,7 +119,7 @@ class PaymentTest extends TestCase
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testClientIdValidation()
|
||||
@ -131,7 +131,7 @@ class PaymentTest extends TestCase
|
||||
'status_id' => Payment::STATUS_COMPLETED,
|
||||
'amount' => 100
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'date' => now()->addDay()->format('Y-m-d')
|
||||
@ -195,7 +195,7 @@ class PaymentTest extends TestCase
|
||||
$i->calc()->getInvoice()->service()->markSent()->save();
|
||||
|
||||
$this->assertGreaterThan(0, $i->balance);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'amount' => 5,
|
||||
@ -220,7 +220,7 @@ class PaymentTest extends TestCase
|
||||
$payment_id = $response->json()['data']['id'];
|
||||
|
||||
$payment = Payment::find($this->decodePrimaryKey($payment_id));
|
||||
|
||||
|
||||
$this->assertNotNull($payment);
|
||||
|
||||
$data = [
|
||||
@ -272,7 +272,7 @@ class PaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson('/api/v1/payments/'.$payment->hashed_id, $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
}
|
||||
@ -305,7 +305,7 @@ class PaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->putJson('/api/v1/payments/'.$payment->hashed_id, $data);
|
||||
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
@ -358,7 +358,7 @@ class PaymentTest extends TestCase
|
||||
'client_id' => $this->client->id,
|
||||
'date' => '2023-01-02',
|
||||
]);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -435,12 +435,12 @@ class PaymentTest extends TestCase
|
||||
];
|
||||
|
||||
$response = false;
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
// $this->assertFalse($response);
|
||||
@ -482,7 +482,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$Payment = Payment::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
|
||||
$Payment->name = \Illuminate\Support\Str::random(54);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -550,7 +550,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testStorePaymentWithClientId()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -607,7 +607,7 @@ class PaymentTest extends TestCase
|
||||
$payment_id = $arr['data']['id'];
|
||||
|
||||
$payment = Payment::with('invoices')->find($this->decodePrimaryKey($payment_id));
|
||||
|
||||
|
||||
$this->assertNotNull($payment);
|
||||
$this->assertNotNull($payment->invoices());
|
||||
$this->assertEquals(1, $payment->invoices->count());
|
||||
@ -616,7 +616,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testStorePaymentWithNoInvoiecs()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -656,14 +656,14 @@ class PaymentTest extends TestCase
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testPartialPaymentAmount()
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -704,7 +704,7 @@ class PaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
@ -722,7 +722,7 @@ class PaymentTest extends TestCase
|
||||
$this->assertEquals($pivot_invoice->partial, 0);
|
||||
$this->assertEquals($pivot_invoice->amount, 10.0000);
|
||||
$this->assertEquals($pivot_invoice->balance, 8.0000);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testPaymentGreaterThanPartial()
|
||||
@ -945,7 +945,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1011,7 +1011,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1070,7 +1070,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1135,7 +1135,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1240,7 +1240,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1295,7 +1295,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testStorePaymentWithNoAmountField()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1361,7 +1361,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testStorePaymentWithZeroAmountField()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1420,7 +1420,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testPaymentForInvoicesFromDifferentClients()
|
||||
{
|
||||
$client1 = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client1 = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client1->id,
|
||||
@ -1429,7 +1429,7 @@ class PaymentTest extends TestCase
|
||||
]);
|
||||
|
||||
|
||||
$client2 = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client2 = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client2->id,
|
||||
@ -1496,7 +1496,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
public function testPaymentWithSameInvoiceMultipleTimes()
|
||||
{
|
||||
$client1 = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client1 = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client1->id,
|
||||
@ -1536,20 +1536,20 @@ class PaymentTest extends TestCase
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
|
||||
|
||||
$response->assertStatus(422);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testStorePaymentWithCredits()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1620,7 +1620,7 @@ class PaymentTest extends TestCase
|
||||
$payment_id = $arr['data']['id'];
|
||||
|
||||
$payment = Payment::find($this->decodePrimaryKey($payment_id));
|
||||
|
||||
|
||||
$this->assertNotNull($payment);
|
||||
$this->assertNotNull($payment->invoices());
|
||||
$this->assertEquals(1, $payment->invoices()->count());
|
||||
@ -1632,7 +1632,7 @@ class PaymentTest extends TestCase
|
||||
$settings = ClientSettings::defaults();
|
||||
$settings->currency_id = '2';
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1693,7 +1693,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1778,7 +1778,7 @@ class PaymentTest extends TestCase
|
||||
{
|
||||
$invoice = null;
|
||||
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -1842,7 +1842,7 @@ class PaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/refund', $data);
|
||||
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
@ -1872,7 +1872,7 @@ class PaymentTest extends TestCase
|
||||
'date' => '2020/12/12',
|
||||
'number' => 'duplicate',
|
||||
];
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
@ -1880,7 +1880,7 @@ sleep(1);
|
||||
])->postJson('/api/v1/payments', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
|
@ -37,8 +37,8 @@ class PaymentV2Test extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -130,7 +130,7 @@ class PaymentV2Test extends TestCase
|
||||
|
||||
public function testStorePaymentWithCreditsThenDeletingInvoices()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id, 'balance' => 20, 'paid_to_date' => 0]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id, 'balance' => 20, 'paid_to_date' => 0]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -192,10 +192,10 @@ class PaymentV2Test extends TestCase
|
||||
|
||||
$response = null;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
@ -258,7 +258,7 @@ class PaymentV2Test extends TestCase
|
||||
|
||||
public function testStorePaymentWithCreditsThenDeletingInvoicesAndThenPayments()
|
||||
{
|
||||
$client = Client::factory()->create(['company_id' =>$this->company->id, 'user_id' => $this->user->id, 'balance' => 100, 'paid_to_date' => 0]);
|
||||
$client = Client::factory()->create(['company_id' => $this->company->id, 'user_id' => $this->user->id, 'balance' => 100, 'paid_to_date' => 0]);
|
||||
ClientContact::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
@ -329,10 +329,10 @@ class PaymentV2Test extends TestCase
|
||||
|
||||
$response = null;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
@ -352,7 +352,7 @@ class PaymentV2Test extends TestCase
|
||||
$this->assertEquals(0, $credit->balance);
|
||||
|
||||
$invoice = $invoice->fresh();
|
||||
|
||||
|
||||
//delete the invoice
|
||||
|
||||
$data = [
|
||||
|
@ -36,7 +36,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -56,7 +56,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
|
||||
public function testUnappliedPaymentsAreEnabled()
|
||||
{
|
||||
|
||||
|
||||
$settings = ClientSettings::defaults();
|
||||
$settings->use_unapplied_payment = 'always';
|
||||
|
||||
@ -82,7 +82,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'amount' => 100,
|
||||
'applied' => 0,
|
||||
'applied' => 0,
|
||||
'refunded' => 0,
|
||||
'status_id' => Payment::STATUS_COMPLETED,
|
||||
'is_deleted' => 0,
|
||||
@ -94,10 +94,9 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
|
||||
// nlog($invoice->balance);
|
||||
|
||||
try{
|
||||
try {
|
||||
$invoice->service()->autoBill()->save();
|
||||
}
|
||||
catch(\Exception $e){
|
||||
} catch(\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@ -110,7 +109,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
$this->assertEquals($payment->applied, $invoice->paid_to_date);
|
||||
$this->assertGreaterThan(2, $invoice->status_id);
|
||||
$this->assertGreaterThan(0, $payment->applied);
|
||||
|
||||
|
||||
// $this->assertEquals(Invoice::STATUS_PAID, $invoice->status_id);
|
||||
// $this->assertEquals(0, $invoice->balance);
|
||||
|
||||
@ -119,7 +118,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
|
||||
public function testUnappliedPaymentsAreDisabled()
|
||||
{
|
||||
|
||||
|
||||
$settings = ClientSettings::defaults();
|
||||
$settings->use_unapplied_payment = 'off';
|
||||
|
||||
@ -146,7 +145,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
'user_id' => $this->user->id,
|
||||
'client_id' => $client->id,
|
||||
'amount' => 100,
|
||||
'applied' => 0,
|
||||
'applied' => 0,
|
||||
'refunded' => 0,
|
||||
'status_id' => Payment::STATUS_COMPLETED
|
||||
]);
|
||||
@ -154,12 +153,11 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
$invoice->service()->markSent()->save();
|
||||
|
||||
$this->assertGreaterThan(0, $invoice->balance);
|
||||
|
||||
|
||||
try {
|
||||
$invoice->service()->autoBill()->save();
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
|
||||
} catch(\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$invoice = $invoice->fresh();
|
||||
@ -177,4 +175,4 @@ class AutoUnappliedPaymentTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class CreditPaymentTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -86,10 +86,10 @@ class CreditPaymentTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -163,7 +163,7 @@ class CreditPaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
@ -29,7 +29,7 @@ class DeletePaymentTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -80,7 +80,7 @@ class DeletePaymentTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
@ -29,7 +29,7 @@ class StorePaymentValidationTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -74,10 +74,10 @@ class StorePaymentValidationTest extends TestCase
|
||||
$response = false;
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@ -95,10 +95,10 @@ class StorePaymentValidationTest extends TestCase
|
||||
$response = false;
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(422);
|
||||
@ -116,10 +116,10 @@ class StorePaymentValidationTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -147,10 +147,10 @@ class StorePaymentValidationTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
@ -176,10 +176,10 @@ class StorePaymentValidationTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/', $data);
|
||||
|
||||
$response->assertStatus(422);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class UnappliedPaymentDeleteTest extends TestCase
|
||||
use MakesHash;
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -178,10 +178,10 @@ class UnappliedPaymentDeleteTest extends TestCase
|
||||
|
||||
$response = null;
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments', $data);
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments', $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
@ -28,7 +28,7 @@ class UnappliedPaymentRefundTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockUnitData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -20,7 +20,8 @@ use Tests\TestCase;
|
||||
|
||||
class ExampleIntegrationTest extends TestCase
|
||||
{
|
||||
use MakesInvoiceValues, MockAccountData;
|
||||
use MakesInvoiceValues;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
@ -16,7 +16,6 @@ use Tests\TestCase;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
|
||||
class CsvConversionTest extends TestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
@ -26,29 +25,27 @@ class CsvConversionTest extends TestCase
|
||||
|
||||
public function testExample()
|
||||
{
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
||||
|
||||
/* Set CSV parsing options */
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
||||
|
||||
$reader->setDelimiter(',');
|
||||
// $reader->setEnclosure('"');
|
||||
$reader->setSheetIndex(0);
|
||||
/* Set CSV parsing options */
|
||||
|
||||
/* Load a CSV file and save as a XLS */
|
||||
$reader->setDelimiter(',');
|
||||
// $reader->setEnclosure('"');
|
||||
$reader->setSheetIndex(0);
|
||||
|
||||
$spreadsheet = $reader->load(base_path().'/tests/Feature/Import/expenses.csv');
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$writer->save(storage_path('/test.xlsx'));
|
||||
/* Load a CSV file and save as a XLS */
|
||||
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
$spreadsheet = $reader->load(base_path().'/tests/Feature/Import/expenses.csv');
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$writer->save(storage_path('/test.xlsx'));
|
||||
|
||||
$this->assertTrue(file_exists(storage_path('/test.xlsx')));
|
||||
unlink(storage_path('/test.xlsx'));
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
|
||||
$this->assertTrue(file_exists(storage_path('/test.xlsx')));
|
||||
unlink(storage_path('/test.xlsx'));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ class PingTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->makeTestData();
|
||||
|
@ -25,7 +25,7 @@ class PreviewTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -33,8 +33,8 @@ class ProductTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -147,7 +147,7 @@ class ProductTest extends TestCase
|
||||
])->post('/api/v1/products/bulk', $update)
|
||||
->assertStatus(200);
|
||||
} catch(\Exception $e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
$p = $p->fresh();
|
||||
|
@ -34,7 +34,7 @@ class ProjectApiTest extends TestCase
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -66,7 +66,7 @@ class ProjectApiTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(0, $arr['data']['task_rate']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testCreateProjectWithNullTaskRate2()
|
||||
@ -109,7 +109,7 @@ class ProjectApiTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(10, $arr['data']['task_rate']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testCreateProjectWithNullTaskRate5()
|
||||
@ -155,7 +155,7 @@ class ProjectApiTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(10, $arr['data']['task_rate']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testProjectIncludesZeroCount()
|
||||
@ -185,7 +185,7 @@ class ProjectApiTest extends TestCase
|
||||
'project_id' => $this->project->id,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$e = Expense::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
@ -193,7 +193,7 @@ class ProjectApiTest extends TestCase
|
||||
'project_id' => $this->project->id,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
$q = Quote::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
|
@ -37,7 +37,7 @@ class PurchaseOrderTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
$this->faker = \Faker\Factory::create();
|
||||
|
||||
$this->makeTestData();
|
||||
@ -57,9 +57,9 @@ class PurchaseOrderTest extends TestCase
|
||||
|
||||
$this->assertEquals($expense->project_id, $this->project->id);
|
||||
$this->assertEquals($expense->client_id, $p->project->client_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testPurchaseOrderHistory()
|
||||
{
|
||||
@ -67,7 +67,7 @@ class PurchaseOrderTest extends TestCase
|
||||
event(new PurchaseOrderWasCreated($this->purchase_order, $this->company, Ninja::eventVars($this->company, $this->user)));
|
||||
|
||||
$ar = new ActivityRepository();
|
||||
$fields = new \stdClass;
|
||||
$fields = new \stdClass();
|
||||
$fields->user_id = $this->purchase_order->user_id;
|
||||
$fields->vendor_id = $this->purchase_order->vendor_id;
|
||||
$fields->company_id = $this->purchase_order->company_id;
|
||||
@ -126,7 +126,7 @@ class PurchaseOrderTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => 'archive',
|
||||
];
|
||||
|
||||
@ -137,7 +137,7 @@ class PurchaseOrderTest extends TestCase
|
||||
->assertStatus(200);
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => 'restore',
|
||||
];
|
||||
|
||||
@ -148,7 +148,7 @@ class PurchaseOrderTest extends TestCase
|
||||
->assertStatus(200);
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => 'delete',
|
||||
];
|
||||
|
||||
@ -160,7 +160,7 @@ class PurchaseOrderTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => 'restore',
|
||||
];
|
||||
|
||||
@ -172,7 +172,7 @@ class PurchaseOrderTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'ids' =>[],
|
||||
'ids' => [],
|
||||
'action' => 'archive',
|
||||
];
|
||||
|
||||
@ -183,7 +183,7 @@ class PurchaseOrderTest extends TestCase
|
||||
->assertStatus(302);
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => '',
|
||||
];
|
||||
|
||||
@ -195,7 +195,7 @@ class PurchaseOrderTest extends TestCase
|
||||
|
||||
|
||||
$data = [
|
||||
'ids' =>[$po->hashed_id],
|
||||
'ids' => [$po->hashed_id],
|
||||
'action' => 'molly',
|
||||
];
|
||||
|
||||
|
@ -42,7 +42,7 @@ class QuoteReminderTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -71,7 +71,7 @@ class QuoteReminderTest extends TestCase
|
||||
public $token;
|
||||
|
||||
public $cu;
|
||||
|
||||
|
||||
public $invoice;
|
||||
|
||||
private function buildData($settings = null)
|
||||
@ -112,7 +112,7 @@ class QuoteReminderTest extends TestCase
|
||||
|
||||
$this->token = \Illuminate\Support\Str::random(64);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $this->user->id;
|
||||
$company_token->company_id = $this->company->id;
|
||||
$company_token->account_id = $this->account->id;
|
||||
@ -162,12 +162,12 @@ class QuoteReminderTest extends TestCase
|
||||
|
||||
public function testNullReminder()
|
||||
{
|
||||
|
||||
|
||||
$settings = $this->company->settings;
|
||||
$settings->enable_quote_reminder1 = false;
|
||||
$settings->quote_schedule_reminder1 = '';
|
||||
$settings->quote_num_days_reminder1 = 1;
|
||||
|
||||
|
||||
$this->buildData(($settings));
|
||||
|
||||
$this->quote->date = now()->subMonths(2)->format('Y-m-d');
|
||||
@ -185,12 +185,12 @@ class QuoteReminderTest extends TestCase
|
||||
|
||||
public function testBeforeValidReminder()
|
||||
{
|
||||
|
||||
|
||||
$settings = $this->company->settings;
|
||||
$settings->enable_quote_reminder1 = true;
|
||||
$settings->quote_schedule_reminder1 = 'before_valid_until_date';
|
||||
$settings->quote_num_days_reminder1 = 1;
|
||||
|
||||
|
||||
$this->buildData(($settings));
|
||||
|
||||
$this->quote->date = now()->addMonth()->format('Y-m-d');
|
||||
|
@ -37,7 +37,7 @@ class QuoteTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -69,7 +69,7 @@ class QuoteTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/quotes', $data);
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
// nlog($arr);
|
||||
|
||||
@ -95,7 +95,7 @@ class QuoteTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEmpty($arr['data']['due_date']);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -128,7 +128,7 @@ class QuoteTest extends TestCase
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertNotEmpty($arr['data']['due_date']);
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -191,7 +191,7 @@ class QuoteTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertEquals(now()->addDay()->format('Y-m-d'), $arr['data']['due_date']);
|
||||
$this->assertEquals(now()->format('Y-m-d'), $arr['data']['partial_due_date']);
|
||||
$this->assertEquals(1, $arr['data']['partial']);
|
||||
@ -215,7 +215,7 @@ class QuoteTest extends TestCase
|
||||
'client_id' => $c->id,
|
||||
'status_id' => 2,
|
||||
'date' => now(),
|
||||
'line_items' =>[
|
||||
'line_items' => [
|
||||
[
|
||||
'type_id' => '2',
|
||||
'cost' => 200,
|
||||
@ -249,7 +249,7 @@ class QuoteTest extends TestCase
|
||||
$t = $p->tasks()->where('description', 'Test200')->first();
|
||||
|
||||
$this->assertEquals(200, $t->rate);
|
||||
|
||||
|
||||
$t = $p->tasks()->where('description', 'Test100')->first();
|
||||
|
||||
$this->assertEquals(100, $t->rate);
|
||||
|
@ -34,7 +34,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -135,7 +135,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => '123321',
|
||||
'frequency_id' => 5,
|
||||
'remaining_cycles' =>5,
|
||||
'remaining_cycles' => 5,
|
||||
'currency_id' => 34545435425
|
||||
];
|
||||
|
||||
@ -155,7 +155,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => '123321',
|
||||
'frequency_id' => 5,
|
||||
'remaining_cycles' =>5,
|
||||
'remaining_cycles' => 5,
|
||||
'currency_id' => 1
|
||||
];
|
||||
|
||||
@ -175,7 +175,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => '123321',
|
||||
'frequency_id' => 5,
|
||||
'remaining_cycles' =>5,
|
||||
'remaining_cycles' => 5,
|
||||
'currency_id' => null
|
||||
];
|
||||
|
||||
@ -183,7 +183,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/recurring_expenses?start=true', $data);
|
||||
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -199,7 +199,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => '123321',
|
||||
'frequency_id' => 5,
|
||||
'remaining_cycles' =>5,
|
||||
'remaining_cycles' => 5,
|
||||
'currency_id' => ""
|
||||
];
|
||||
|
||||
@ -207,7 +207,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/recurring_expenses?start=true', $data);
|
||||
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
$response->assertStatus(200);
|
||||
@ -423,7 +423,7 @@ class RecurringExpenseApiTest extends TestCase
|
||||
'client_id' => $this->client->hashed_id,
|
||||
'number' => '123321',
|
||||
'frequency_id' => 5,
|
||||
'remaining_cycles' =>5,
|
||||
'remaining_cycles' => 5,
|
||||
];
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
@ -44,7 +44,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -68,14 +68,14 @@ class RecurringInvoiceTest extends TestCase
|
||||
'frequency_id' => 5,
|
||||
'next_send_date' => '0001-01-01',
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/recurring_invoices', $data)
|
||||
->assertStatus(422);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function testLinkingSubscription()
|
||||
{
|
||||
@ -106,11 +106,11 @@ class RecurringInvoiceTest extends TestCase
|
||||
])->postJson('/api/v1/recurring_invoices/bulk', $data)
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$arr = $response->json();
|
||||
|
||||
$r = $r->fresh();
|
||||
$r = $r->fresh();
|
||||
|
||||
$this->assertEquals($s2->id, $r->subscription_id);
|
||||
$this->assertEquals($s2->id, $r->subscription_id);
|
||||
|
||||
|
||||
}
|
||||
@ -200,7 +200,7 @@ class RecurringInvoiceTest extends TestCase
|
||||
->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
|
||||
$this->assertEquals(now()->startOfDay(), $arr['data']['next_send_date']);
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class RecurringInvoicesCronTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -31,8 +31,8 @@ class RecurringQuoteTest extends TestCase
|
||||
use MockAccountData;
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class RecurringQuotesTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class RefundTest extends TestCase
|
||||
|
||||
public $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -82,7 +82,7 @@ class RefundTest extends TestCase
|
||||
|
||||
$payment_id = $arr['data']['id'];
|
||||
|
||||
$item = new InvoiceItem;
|
||||
$item = new InvoiceItem();
|
||||
$item->cost = 300;
|
||||
$item->quantity = 1;
|
||||
|
||||
@ -250,12 +250,12 @@ class RefundTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/refund', $data);
|
||||
|
||||
|
||||
|
||||
$arr = $response->json();
|
||||
|
||||
@ -352,7 +352,7 @@ class RefundTest extends TestCase
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/payments/refund', $data);
|
||||
$response->assertStatus(422);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -792,7 +792,7 @@ class RefundTest extends TestCase
|
||||
'balance' => 1000,
|
||||
]);
|
||||
|
||||
$item = new InvoiceItem;
|
||||
$item = new InvoiceItem();
|
||||
$item->cost = 1000;
|
||||
$item->quantity = 1;
|
||||
|
||||
@ -825,9 +825,9 @@ class RefundTest extends TestCase
|
||||
$this->assertNotNull($c);
|
||||
$this->assertEquals(2, $c->status_id);
|
||||
|
||||
$this->assertEquals($cl->id, $c->client_id);
|
||||
$this->assertEquals($cl->id, $c->client_id);
|
||||
|
||||
$this->assertEquals($cl->id, $i->client_id);
|
||||
$this->assertEquals($cl->id, $i->client_id);
|
||||
|
||||
$data = [
|
||||
'amount' => 900,
|
||||
@ -872,7 +872,7 @@ $this->assertEquals($cl->id, $i->client_id);
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -883,10 +883,10 @@ $this->assertEquals($cl->id, $i->client_id);
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(0, $arr['data']['refunded']);
|
||||
|
||||
|
||||
$this->assertEquals(10, $c->fresh()->balance);
|
||||
$this->assertEquals(10, $i->fresh()->balance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testRefundsWithSplitCreditAndPaymentRefund()
|
||||
@ -956,7 +956,7 @@ $this->assertEquals($cl->id, $i->client_id);
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
@ -967,10 +967,10 @@ $this->assertEquals($cl->id, $i->client_id);
|
||||
$arr = $response->json();
|
||||
|
||||
$this->assertEquals(100, $arr['data']['refunded']);
|
||||
|
||||
|
||||
$this->assertEquals(100, $c->fresh()->balance);
|
||||
$this->assertEquals(200, $i->fresh()->balance);
|
||||
|
||||
|
||||
$this->assertEquals(900, $payment->fresh()->amount);
|
||||
$this->assertEquals(900, $payment->fresh()->applied);
|
||||
$this->assertEquals(100, $payment->fresh()->refunded);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user