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
@ -26,7 +26,7 @@ class ActivityApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -298,10 +298,10 @@ class ActivityApiTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/activities/entity', $data);
|
])->postJson('/api/v1/activities/entity', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class ApplePayDomainMerchantUrlTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -43,12 +43,12 @@ class ApplePayDomainMerchantUrlTest extends TestCase
|
|||||||
$this->markTestSkipped('Skip test no company gateways installed');
|
$this->markTestSkipped('Skip test no company gateways installed');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$config = new \stdClass;
|
$config = new \stdClass();
|
||||||
$config->publishableKey = 'pk_test';
|
$config->publishableKey = 'pk_test';
|
||||||
$config->apiKey = 'sk_test';
|
$config->apiKey = 'sk_test';
|
||||||
$config->appleDomainVerification = 'merchant_id';
|
$config->appleDomainVerification = 'merchant_id';
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
@ -26,7 +26,7 @@ class BankTransactionRuleTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class BankTransactionRuleTest extends TestCase
|
|||||||
'applies_to' => 'DEBIT',
|
'applies_to' => 'DEBIT',
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'vendor_id' => $this->vendor->id,
|
'vendor_id' => $this->vendor->id,
|
||||||
'category_id' =>$this->expense_category->id,
|
'category_id' => $this->expense_category->id,
|
||||||
'rules' => [
|
'rules' => [
|
||||||
[
|
[
|
||||||
'search_key' => 'description',
|
'search_key' => 'description',
|
||||||
@ -268,7 +268,7 @@ class BankTransactionRuleTest extends TestCase
|
|||||||
|
|
||||||
$this->assertNotNull($bt->expense_id);
|
$this->assertNotNull($bt->expense_id);
|
||||||
|
|
||||||
$bt=null;
|
$bt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class BankTransactionTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class YodleeBankTransactionTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class BankIntegrationApiTest extends TestCase
|
|||||||
|
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class BankTransactionApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class BankTransactionRuleApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class BaseApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ class BaseApiTest extends TestCase
|
|||||||
|
|
||||||
$user_id = $owner_user->id;
|
$user_id = $owner_user->id;
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $owner_user->id;
|
$company_token->user_id = $owner_user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $this->account->id;
|
$company_token->account_id = $this->account->id;
|
||||||
@ -186,7 +186,7 @@ class BaseApiTest extends TestCase
|
|||||||
|
|
||||||
$this->low_token = \Illuminate\Support\Str::random(64);
|
$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->user_id = $lower_permission_user->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->id;
|
$company_token->account_id = $this->account->id;
|
||||||
@ -326,7 +326,7 @@ class BaseApiTest extends TestCase
|
|||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$gs = new GroupSetting;
|
$gs = new GroupSetting();
|
||||||
$gs->name = 'Test';
|
$gs->name = 'Test';
|
||||||
$gs->company_id = $client->company_id;
|
$gs->company_id = $client->company_id;
|
||||||
$gs->settings = ClientSettings::buildClientSettings($company->settings, $client->settings);
|
$gs->settings = ClientSettings::buildClientSettings($company->settings, $client->settings);
|
||||||
@ -372,7 +372,7 @@ class BaseApiTest extends TestCase
|
|||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $company->id;
|
$cg->company_id = $company->id;
|
||||||
$cg->user_id = $user_id;
|
$cg->user_id = $user_id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
@ -29,7 +29,7 @@ class CancelInvoiceTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ClassificationTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients/",$data)
|
])->postJson("/api/v1/clients/", $data)
|
||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
@ -274,7 +274,7 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->assertStatus(200);
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
@ -292,7 +292,7 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients/",$data)
|
])->postJson("/api/v1/clients/", $data)
|
||||||
->assertStatus(422);
|
->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -322,12 +322,12 @@ class ClientApiTest extends TestCase
|
|||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients/",$data)
|
])->postJson("/api/v1/clients/", $data)
|
||||||
->assertStatus(200);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients/",$data)
|
])->postJson("/api/v1/clients/", $data)
|
||||||
->assertStatus(200);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'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);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients",$data)
|
])->postJson("/api/v1/clients", $data)
|
||||||
->assertStatus(422);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients",$data)
|
])->postJson("/api/v1/clients", $data)
|
||||||
->assertStatus(200);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients",$data)
|
])->postJson("/api/v1/clients", $data)
|
||||||
->assertStatus(200);
|
->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([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients",$data)
|
])->postJson("/api/v1/clients", $data)
|
||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -569,7 +569,7 @@ class ClientApiTest extends TestCase
|
|||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->invoice->documents()->save($d);
|
$this->invoice->documents()->save($d);
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
@ -675,29 +675,29 @@ class ClientApiTest extends TestCase
|
|||||||
$this->assertCount(6, $arr['data']);
|
$this->assertCount(6, $arr['data']);
|
||||||
|
|
||||||
|
|
||||||
$d = \App\Models\Document::factory()->create([
|
$d = \App\Models\Document::factory()->create([
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$t = \App\Models\Task::factory()->create([
|
$t = \App\Models\Task::factory()->create([
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$t->documents()->save($d);
|
$t->documents()->save($d);
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson("/api/v1/clients/{$this->client->hashed_id}/documents")
|
])->postJson("/api/v1/clients/{$this->client->hashed_id}/documents")
|
||||||
->assertStatus(200);
|
->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);
|
$different_company_token = \Illuminate\Support\Str::random(64);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $user->id;
|
$company_token->user_id = $user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $account->id;
|
$company_token->account_id = $account->id;
|
||||||
@ -846,10 +846,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
'status' => 'paid',
|
'status' => 'paid',
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/client_statement?send_email=true', $data);
|
])->postJson('/api/v1/client_statement?send_email=true', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertJson([
|
$response->assertJson([
|
||||||
@ -931,7 +931,7 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
public function testClientSettingsSave()
|
public function testClientSettingsSave()
|
||||||
{
|
{
|
||||||
$std = new \stdClass;
|
$std = new \stdClass();
|
||||||
$std->entity = 'App\\Models\\Client';
|
$std->entity = 'App\\Models\\Client';
|
||||||
$std->currency_id = 3;
|
$std->currency_id = 3;
|
||||||
|
|
||||||
@ -945,7 +945,7 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
public function testClientSettingsSave2()
|
public function testClientSettingsSave2()
|
||||||
{
|
{
|
||||||
$std = new \stdClass;
|
$std = new \stdClass();
|
||||||
$std->entity = 'App\\Models\\Client';
|
$std->entity = 'App\\Models\\Client';
|
||||||
$std->industry_id = '';
|
$std->industry_id = '';
|
||||||
$std->size_id = '';
|
$std->size_id = '';
|
||||||
@ -1022,7 +1022,7 @@ $this->assertCount(7, $arr['data']);
|
|||||||
$repository = app()->make($repository_name);
|
$repository = app()->make($repository_name);
|
||||||
$repository->import_mode = true;
|
$repository->import_mode = true;
|
||||||
|
|
||||||
$_syn_request_class = new $request_name;
|
$_syn_request_class = new $request_name();
|
||||||
$_syn_request_class->setContainer(app());
|
$_syn_request_class->setContainer(app());
|
||||||
$_syn_request_class->initialize($data);
|
$_syn_request_class->initialize($data);
|
||||||
$_syn_request_class->prepareForValidation();
|
$_syn_request_class->prepareForValidation();
|
||||||
@ -1123,10 +1123,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -1156,10 +1156,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -1178,10 +1178,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -1201,10 +1201,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -1224,10 +1224,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -1242,10 +1242,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
@ -1259,10 +1259,10 @@ $this->assertCount(7, $arr['data']);
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/clients/', $data);
|
])->postJson('/api/v1/clients/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
@ -29,7 +29,7 @@ class ClientDeletedInvoiceCreationTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class ClientGatewayTokenApiTest extends TestCase
|
|||||||
protected $faker;
|
protected $faker;
|
||||||
protected CompanyGateway $cg;
|
protected CompanyGateway $cg;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class ClientGatewayTokenApiTest extends TestCase
|
|||||||
//disable ach here
|
//disable ach here
|
||||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
$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->company_id = $this->company->id;
|
||||||
$this->cg->user_id = $this->user->id;
|
$this->cg->user_id = $this->user->id;
|
||||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
@ -27,7 +27,7 @@ class ClientModelTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -41,8 +41,9 @@ class ClientModelTest extends TestCase
|
|||||||
$this->markTestSkipped('Skip test no company gateways installed');
|
$this->markTestSkipped('Skip test no company gateways installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CompanyGateway::count() == 0)
|
if(CompanyGateway::count() == 0) {
|
||||||
$this->markTestSkipped('Skip test no company gateways installed');
|
$this->markTestSkipped('Skip test no company gateways installed');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ class ClientModelTest extends TestCase
|
|||||||
|
|
||||||
$this->invoice->amount = 10;
|
$this->invoice->amount = 10;
|
||||||
$this->invoice->balance = 10;
|
$this->invoice->balance = 10;
|
||||||
$this->invoice->status_id=2;
|
$this->invoice->status_id = 2;
|
||||||
$this->invoice->date = now()->subDays(2);
|
$this->invoice->date = now()->subDays(2);
|
||||||
$this->invoice->due_date = now()->addDays(2);
|
$this->invoice->due_date = now()->addDays(2);
|
||||||
$this->invoice->save();
|
$this->invoice->save();
|
||||||
@ -106,7 +107,7 @@ class ClientModelTest extends TestCase
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
|
||||||
$this->assertEquals($invoice_count+2, count($arr['data']));
|
$this->assertEquals($invoice_count + 2, count($arr['data']));
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
@ -25,9 +25,10 @@ use App\Utils\Traits\AppSetup;
|
|||||||
use Faker\Factory;
|
use Faker\Factory;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
use function now;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
use function now;
|
||||||
|
|
||||||
class CreditsTest extends TestCase
|
class CreditsTest extends TestCase
|
||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
@ -24,7 +24,7 @@ class ClientPresenterTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class ClientTest extends TestCase
|
|||||||
|
|
||||||
public $client_id;
|
public $client_id;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class ClientTest extends TestCase
|
|||||||
$this->assertEquals($gs->id, $c->group_settings_id);
|
$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']);
|
$this->assertEquals($gs->hashed_id, $client_response['group_settings_id']);
|
||||||
}
|
}
|
||||||
@ -128,14 +128,14 @@ class ClientTest extends TestCase
|
|||||||
|
|
||||||
$this->company->saveSettings($settings, $this->company);
|
$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);
|
$aud_currency = Currency::find(12);
|
||||||
$eur_currency = Currency::find(3);
|
$eur_currency = Currency::find(3);
|
||||||
|
|
||||||
$synthetic_exchange = $aud_currency->exchange_rate / $eur_currency->exchange_rate;
|
$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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class ClientTest extends TestCase
|
|||||||
{
|
{
|
||||||
$line_items = [];
|
$line_items = [];
|
||||||
|
|
||||||
for ($x=0; $x<$number; $x++) {
|
for ($x = 0; $x < $number; $x++) {
|
||||||
$item = InvoiceItemFactory::create();
|
$item = InvoiceItemFactory::create();
|
||||||
$item->quantity = 1;
|
$item->quantity = 1;
|
||||||
$item->cost = 10;
|
$item->cost = 10;
|
||||||
@ -570,7 +570,7 @@ class ClientTest extends TestCase
|
|||||||
'is_locked' => 0,
|
'is_locked' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $user->id;
|
$company_token->user_id = $user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $account->id;
|
$company_token->account_id = $account->id;
|
||||||
@ -625,7 +625,7 @@ class ClientTest extends TestCase
|
|||||||
'is_locked' => 0,
|
'is_locked' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $user->id;
|
$company_token->user_id = $user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $account->id;
|
$company_token->account_id = $account->id;
|
||||||
|
@ -34,7 +34,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
use CompanyGatewayFeesAndLimitsSaver;
|
use CompanyGatewayFeesAndLimitsSaver;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
|
|
||||||
public function testCompanyGatewayFeesAndLimitsSuccess()
|
public function testCompanyGatewayFeesAndLimitsSuccess()
|
||||||
{
|
{
|
||||||
$fee = new FeesAndLimits;
|
$fee = new FeesAndLimits();
|
||||||
|
|
||||||
$fee = (array) $fee;
|
$fee = (array) $fee;
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
|
|
||||||
public function testCompanyGatewayFeesAndLimitsFails()
|
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;
|
$fee_and_limit['bank_transfer']->adjust_fee_percent = 10;
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
'max_limit' => 2,
|
'max_limit' => 2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$fal = (array) new FeesAndLimits;
|
$fal = (array) new FeesAndLimits();
|
||||||
|
|
||||||
$new_arr = array_replace($fal, $arr);
|
$new_arr = array_replace($fal, $arr);
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeeAmountCalcuation()
|
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}}
|
//{"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_amount = 10;
|
||||||
// $fee->fee_percent = 2;
|
// $fee->fee_percent = 2;
|
||||||
// $fee->fee_tax_name1 = 'GST';
|
// $fee->fee_tax_name1 = 'GST';
|
||||||
@ -294,7 +294,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentCalcuation()
|
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}}
|
//{"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_amount = 10;
|
||||||
$fee->fee_percent = 2;
|
$fee->fee_percent = 2;
|
||||||
// $fee->fee_tax_name1 = 'GST';
|
// $fee->fee_tax_name1 = 'GST';
|
||||||
@ -327,7 +327,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountCalcuation()
|
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}}
|
//{"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_amount = 10;
|
||||||
$fee->fee_percent = 2;
|
$fee->fee_percent = 2;
|
||||||
// $fee->fee_tax_name1 = 'GST';
|
// $fee->fee_tax_name1 = 'GST';
|
||||||
@ -360,7 +360,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercent()
|
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}}
|
//{"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_amount = 0;
|
||||||
$fee->fee_percent = 100;
|
$fee->fee_percent = 100;
|
||||||
$fee->adjust_fee_percent = false;
|
$fee->adjust_fee_percent = false;
|
||||||
@ -393,7 +393,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
|
|
||||||
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercentVariationOne()
|
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercentVariationOne()
|
||||||
{
|
{
|
||||||
$fee = new FeesAndLimits;
|
$fee = new FeesAndLimits();
|
||||||
$fee->fee_amount = 0;
|
$fee->fee_amount = 0;
|
||||||
$fee->fee_percent = 10;
|
$fee->fee_percent = 10;
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuation()
|
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}}
|
//{"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_amount = 10;
|
||||||
// $fee->fee_percent = 2;
|
// $fee->fee_percent = 2;
|
||||||
$fee->fee_tax_name1 = 'GST';
|
$fee->fee_tax_name1 = 'GST';
|
||||||
@ -457,7 +457,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuationInclusiveTaxes()
|
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}}
|
//{"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_amount = 10;
|
||||||
// $fee->fee_percent = 2;
|
// $fee->fee_percent = 2;
|
||||||
$fee->fee_tax_name1 = 'GST';
|
$fee->fee_tax_name1 = 'GST';
|
||||||
@ -490,7 +490,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuation()
|
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}}
|
//{"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_amount = 10;
|
||||||
// $fee->fee_percent = 2;
|
// $fee->fee_percent = 2;
|
||||||
$fee->fee_tax_name1 = 'GST';
|
$fee->fee_tax_name1 = 'GST';
|
||||||
@ -525,7 +525,7 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuationWithFeeCap()
|
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}}
|
//{"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_amount = 10;
|
||||||
// $fee->fee_percent = 2;
|
// $fee->fee_percent = 2;
|
||||||
$fee->fee_tax_name1 = 'GST';
|
$fee->fee_tax_name1 = 'GST';
|
||||||
|
@ -35,7 +35,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
|||||||
|
|
||||||
public $cg1;
|
public $cg1;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
|||||||
|
|
||||||
$this->withoutExceptionHandling();
|
$this->withoutExceptionHandling();
|
||||||
|
|
||||||
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg){
|
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg) {
|
||||||
$cg->forceDelete();
|
$cg->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
|||||||
//disable ach here
|
//disable ach here
|
||||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
$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->company_id = $this->company->id;
|
||||||
$this->cg->user_id = $this->user->id;
|
$this->cg->user_id = $this->user->id;
|
||||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -185,7 +185,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
|||||||
//disable ach here
|
//disable ach here
|
||||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
$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->company_id = $this->company->id;
|
||||||
$this->cg->user_id = $this->user->id;
|
$this->cg->user_id = $this->user->id;
|
||||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -237,7 +237,7 @@ class CompanyGatewayResolutionTest extends TestCase
|
|||||||
//disable ach here
|
//disable ach here
|
||||||
$json_config = json_decode(config('ninja.testvars.stripe'));
|
$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->company_id = $this->company->id;
|
||||||
$this->cg->user_id = $this->user->id;
|
$this->cg->user_id = $this->user->id;
|
||||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
@ -30,7 +30,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
// use RefreshDatabase;
|
// use RefreshDatabase;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
$data[1]['fee_cap'] = 0;
|
$data[1]['fee_cap'] = 0;
|
||||||
$data[1]['is_enabled'] = true;
|
$data[1]['is_enabled'] = true;
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -152,7 +152,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
$data[1]['fee_cap'] = 0;
|
$data[1]['fee_cap'] = 0;
|
||||||
$data[1]['is_enabled'] = true;
|
$data[1]['is_enabled'] = true;
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -191,7 +191,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
$data[1]['fee_cap'] = 0;
|
$data[1]['fee_cap'] = 0;
|
||||||
$data[1]['is_enabled'] = true;
|
$data[1]['is_enabled'] = true;
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -237,7 +237,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
$data[1]['fee_cap'] = 0;
|
$data[1]['fee_cap'] = 0;
|
||||||
$data[1]['is_enabled'] = true;
|
$data[1]['is_enabled'] = true;
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
@ -285,7 +285,7 @@ class CompanyGatewayTest extends TestCase
|
|||||||
$data[1]['fee_cap'] = 0;
|
$data[1]['fee_cap'] = 0;
|
||||||
$data[1]['is_enabled'] = true;
|
$data[1]['is_enabled'] = true;
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
use App\DataMapper\CompanySettings;
|
use App\DataMapper\CompanySettings;
|
||||||
@ -31,7 +32,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
// use RefreshDatabase;
|
// use RefreshDatabase;
|
||||||
|
|
||||||
public function setUp() :void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class CompanyTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class CompanyTokenApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class DeleteInvoiceTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class DesignApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class DocumentsApiTest extends TestCase
|
|||||||
|
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class DocumentsApiTest extends TestCase
|
|||||||
|
|
||||||
public function testDocumentFilters()
|
public function testDocumentFilters()
|
||||||
{
|
{
|
||||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||||
$d->forceDelete();
|
$d->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class DocumentsApiTest extends TestCase
|
|||||||
|
|
||||||
public function testDocumentFilters2()
|
public function testDocumentFilters2()
|
||||||
{
|
{
|
||||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||||
$d->forceDelete();
|
$d->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class DocumentsApiTest extends TestCase
|
|||||||
|
|
||||||
public function testDocumentFilters3()
|
public function testDocumentFilters3()
|
||||||
{
|
{
|
||||||
Document::query()->withTrashed()->cursor()->each(function ($d){
|
Document::query()->withTrashed()->cursor()->each(function ($d) {
|
||||||
$d->forceDelete();
|
$d->forceDelete();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class FacturaeTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class FatturaPATest extends TestCase
|
|||||||
'settings' => $client_settings,
|
'settings' => $client_settings,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$item = new InvoiceItem;
|
$item = new InvoiceItem();
|
||||||
$item->product_key = "Product Key";
|
$item->product_key = "Product Key";
|
||||||
$item->notes = "Product Description";
|
$item->notes = "Product Description";
|
||||||
$item->cost = 10;
|
$item->cost = 10;
|
||||||
@ -110,7 +110,7 @@ class FatturaPATest extends TestCase
|
|||||||
'tax_name2' => '',
|
'tax_name2' => '',
|
||||||
'tax_name3' => '',
|
'tax_name3' => '',
|
||||||
'line_items' => [$item],
|
'line_items' => [$item],
|
||||||
'number' => 'ITA-'.rand(1000,100000)
|
'number' => 'ITA-'.rand(1000, 100000)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$invoice->service()->markSent()->save();
|
$invoice->service()->markSent()->save();
|
||||||
@ -126,11 +126,12 @@ class FatturaPATest extends TestCase
|
|||||||
$this->assertInstanceOf(FatturaElettronicaBody::class, $fe->FatturaElettronicaBody[0]);
|
$this->assertInstanceOf(FatturaElettronicaBody::class, $fe->FatturaElettronicaBody[0]);
|
||||||
$this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader);
|
$this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader);
|
||||||
|
|
||||||
$e = new EInvoice;
|
$e = new EInvoice();
|
||||||
$errors = $e->validate($fe);
|
$errors = $e->validate($fe);
|
||||||
|
|
||||||
if(count($errors) > 0)
|
if(count($errors) > 0) {
|
||||||
nlog($errors);
|
nlog($errors);
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertCount(0, $errors);
|
$this->assertCount(0, $errors);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PeppolTest extends TestCase
|
|||||||
$pm->PayeeFinancialAccount = $pfa;
|
$pm->PayeeFinancialAccount = $pfa;
|
||||||
$einvoice->PaymentMeans[] = $pm;
|
$einvoice->PaymentMeans[] = $pm;
|
||||||
|
|
||||||
$stub = new \stdClass;
|
$stub = new \stdClass();
|
||||||
$stub->Invoice = $einvoice;
|
$stub->Invoice = $einvoice;
|
||||||
|
|
||||||
$company = Company::factory()->create([
|
$company = Company::factory()->create([
|
||||||
|
@ -31,7 +31,7 @@ class EntityPaidToDateTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class ExpenseApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class ExpenseCategoryApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class ArDetailReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ArSummaryReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ClientBalanceReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class ClientCsvTest extends TestCase
|
|||||||
use MakesHash;
|
use MakesHash;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class ClientSalesReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class ExportCsvTest extends TestCase
|
|||||||
use MakesHash;
|
use MakesHash;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class ProductSalesReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class ProfitAndLossReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class ReportApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
|
|
||||||
$this->token = \Illuminate\Support\Str::random(64);
|
$this->token = \Illuminate\Support\Str::random(64);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $this->user->id;
|
$company_token->user_id = $this->user->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->id;
|
$company_token->account_id = $this->account->id;
|
||||||
@ -270,7 +270,7 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
{
|
{
|
||||||
Invoice::factory()->count(5)->create(
|
Invoice::factory()->count(5)->create(
|
||||||
[
|
[
|
||||||
'client_id'=> $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'user_id' => $this->user->id
|
'user_id' => $this->user->id
|
||||||
]
|
]
|
||||||
@ -694,7 +694,7 @@ class ReportCsvGenerationTest extends TestCase
|
|||||||
|
|
||||||
$csv = $response->body();
|
$csv = $response->body();
|
||||||
|
|
||||||
// nlog($csv);
|
// nlog($csv);
|
||||||
$this->assertEquals(3600, $this->getFirstValueByColumn($csv, 'Task Duration'));
|
$this->assertEquals(3600, $this->getFirstValueByColumn($csv, 'Task Duration'));
|
||||||
$this->assertEquals('test1', $this->getFirstValueByColumn($csv, 'Task Description'));
|
$this->assertEquals('test1', $this->getFirstValueByColumn($csv, 'Task Description'));
|
||||||
$this->assertEquals('16/Jul/2023', $this->getFirstValueByColumn($csv, 'Task Start Date'));
|
$this->assertEquals('16/Jul/2023', $this->getFirstValueByColumn($csv, 'Task Start Date'));
|
||||||
|
@ -32,7 +32,7 @@ class TaxSummaryReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class UserSalesReportTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class FilterApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -125,8 +125,8 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testInvoiceDelayedNotificationPayment()
|
public function testInvoiceDelayedNotificationPayment()
|
||||||
{
|
{
|
||||||
$gocardlesspayment = new \stdClass;
|
$gocardlesspayment = new \stdClass();
|
||||||
$links = new \stdClass;
|
$links = new \stdClass();
|
||||||
$links->mandate = "my_mandate";
|
$links->mandate = "my_mandate";
|
||||||
$gocardlesspayment->links = $links;
|
$gocardlesspayment->links = $links;
|
||||||
$gocardlesspayment->id = "gocardless_payment_id";
|
$gocardlesspayment->id = "gocardless_payment_id";
|
||||||
@ -172,7 +172,7 @@ class GoCardlessInstantBankPaymentTest extends TestCase
|
|||||||
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
|
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
|
||||||
|
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = 'b9886f9257f0c6ee7c302f1c74475f6c';
|
$cg->gateway_key = 'b9886f9257f0c6ee7c302f1c74475f6c';
|
||||||
|
@ -41,7 +41,7 @@ class GroupSettingTest extends TestCase
|
|||||||
public function testCastingMagic()
|
public function testCastingMagic()
|
||||||
{
|
{
|
||||||
|
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
$settings->tax_name1 = '';
|
$settings->tax_name1 = '';
|
||||||
$settings->tax_rate1 = 0;
|
$settings->tax_rate1 = 0;
|
||||||
@ -51,7 +51,7 @@ class GroupSettingTest extends TestCase
|
|||||||
$this->assertEquals("", $settings->tax_name1);
|
$this->assertEquals("", $settings->tax_name1);
|
||||||
$settings = null;
|
$settings = null;
|
||||||
|
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
$settings->tax_name1 = "1";
|
$settings->tax_name1 = "1";
|
||||||
$settings->tax_rate1 = 0;
|
$settings->tax_rate1 = 0;
|
||||||
@ -63,7 +63,7 @@ class GroupSettingTest extends TestCase
|
|||||||
$settings = $s->cast($settings)->toArray();
|
$settings = $s->cast($settings)->toArray();
|
||||||
$this->assertEquals("1", $settings['tax_name1']);
|
$this->assertEquals("1", $settings['tax_name1']);
|
||||||
|
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
$settings->tax_name1 = [];
|
$settings->tax_name1 = [];
|
||||||
$settings->tax_rate1 = 0;
|
$settings->tax_rate1 = 0;
|
||||||
@ -75,9 +75,9 @@ class GroupSettingTest extends TestCase
|
|||||||
$settings = $s->cast($settings)->toArray();
|
$settings = $s->cast($settings)->toArray();
|
||||||
$this->assertEquals("", $settings['tax_name1']);
|
$this->assertEquals("", $settings['tax_name1']);
|
||||||
|
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
$settings->tax_name1 = new \stdClass;
|
$settings->tax_name1 = new \stdClass();
|
||||||
$settings->tax_rate1 = 0;
|
$settings->tax_rate1 = 0;
|
||||||
|
|
||||||
$settings = $s->cast($settings)->toObject();
|
$settings = $s->cast($settings)->toObject();
|
||||||
@ -94,7 +94,7 @@ class GroupSettingTest extends TestCase
|
|||||||
|
|
||||||
public function testTaxNameInGroupFilters()
|
public function testTaxNameInGroupFilters()
|
||||||
{
|
{
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
$settings->tax_name1 = '';
|
$settings->tax_name1 = '';
|
||||||
$settings->tax_rate1 = 0;
|
$settings->tax_rate1 = 0;
|
||||||
@ -120,7 +120,7 @@ class GroupSettingTest extends TestCase
|
|||||||
|
|
||||||
public function testAddGroupFilters()
|
public function testAddGroupFilters()
|
||||||
{
|
{
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -156,7 +156,7 @@ class GroupSettingTest extends TestCase
|
|||||||
|
|
||||||
public function testAddGroupSettings()
|
public function testAddGroupSettings()
|
||||||
{
|
{
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -179,7 +179,7 @@ class GroupSettingTest extends TestCase
|
|||||||
|
|
||||||
public function testArchiveGroupSettings()
|
public function testArchiveGroupSettings()
|
||||||
{
|
{
|
||||||
$settings = new \stdClass;
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = '1';
|
$settings->currency_id = '1';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -28,7 +28,8 @@ class ImportQuickbooksControllerTest extends TestCase
|
|||||||
private $mock;
|
private $mock;
|
||||||
private $state;
|
private $state;
|
||||||
|
|
||||||
protected function setUp(): void {
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
|||||||
Cache::spy();
|
Cache::spy();
|
||||||
Cache::shouldReceive('get')
|
Cache::shouldReceive('get')
|
||||||
->with($token = $this->company->company_key)
|
->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')
|
Cache::shouldReceive('has')
|
||||||
->andReturn(true);
|
->andReturn(true);
|
||||||
// Perform the test
|
// Perform the test
|
||||||
@ -67,7 +68,7 @@ class ImportQuickbooksControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$token = ['company_key' => $this->company->company_key, 'id' => $this->company->id] ;
|
$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('getAccessToken')->andReturn('abcdefg');
|
||||||
$mock->shouldReceive('getRefreshToken')->andReturn('abcdefghi');
|
$mock->shouldReceive('getRefreshToken')->andReturn('abcdefghi');
|
||||||
$mock->shouldReceive('getAccessTokenExpiresAt')->andReturn(3600);
|
$mock->shouldReceive('getAccessTokenExpiresAt')->andReturn(3600);
|
||||||
@ -87,29 +88,29 @@ class ImportQuickbooksControllerTest extends TestCase
|
|||||||
|
|
||||||
Cache::shouldHaveReceived('put')->once()->with($token['company_key'], 'abcdefg', 3600);
|
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
|
public function testImport(): void
|
||||||
{
|
{
|
||||||
// Cache::spy();
|
// Cache::spy();
|
||||||
//Bus::fake();
|
//Bus::fake();
|
||||||
$data = $this->setUpTestData('customers');
|
$data = $this->setUpTestData('customers');
|
||||||
$count = count($data);
|
$count = count($data);
|
||||||
$this->mock->shouldReceive('Query')->andReturnUsing(
|
$this->mock->shouldReceive('Query')->andReturnUsing(
|
||||||
function($val, $s = 1, $max = 1000) use ($count, $data) {
|
function ($val, $s = 1, $max = 1000) use ($count, $data) {
|
||||||
if(stristr($val, 'count')) {
|
if(stristr($val, 'count')) {
|
||||||
return $count;
|
return $count;
|
||||||
}
|
|
||||||
|
|
||||||
return Arr::take($data,$max);
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
return Arr::take($data, $max);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Perform the test
|
// Perform the test
|
||||||
$response = $this->actingAs($this->user)->withHeaders([
|
$response = $this->actingAs($this->user)->withHeaders([
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/import/quickbooks',[
|
])->post('/api/v1/import/quickbooks', [
|
||||||
'import_types' => ['client']
|
'import_types' => ['client']
|
||||||
]);
|
]);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -118,9 +119,11 @@ class ImportQuickbooksControllerTest extends TestCase
|
|||||||
//Bus::assertDispatched(\App\Jobs\Import\QuickbooksIngest::class);
|
//Bus::assertDispatched(\App\Jobs\Import\QuickbooksIngest::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUpTestData($file) {
|
protected function setUpTestData($file)
|
||||||
|
{
|
||||||
$data = json_decode(
|
$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;
|
return $data;
|
||||||
|
@ -32,7 +32,7 @@ class BaseTransformerTest extends TestCase
|
|||||||
use MakesHash;
|
use MakesHash;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
|
|
||||||
public $ids;
|
public $ids;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
|
|
||||||
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||||
|
|
||||||
$zip = new \ZipArchive;
|
$zip = new \ZipArchive();
|
||||||
$res = $zip->open($backup_json_file_zip);
|
$res = $zip->open($backup_json_file_zip);
|
||||||
if ($res === true) {
|
if ($res === true) {
|
||||||
$zip->extractTo(sys_get_temp_dir());
|
$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';
|
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
|
||||||
|
|
||||||
$zip = new \ZipArchive;
|
$zip = new \ZipArchive();
|
||||||
$res = $zip->open($backup_json_file_zip);
|
$res = $zip->open($backup_json_file_zip);
|
||||||
|
|
||||||
if ($res === true) {
|
if ($res === true) {
|
||||||
@ -423,7 +423,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
$this->genericImport(
|
$this->genericImport(
|
||||||
Vendor::class,
|
Vendor::class,
|
||||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'],
|
['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',
|
'vendors',
|
||||||
'number'
|
'number'
|
||||||
);
|
);
|
||||||
@ -437,7 +437,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
$this->genericImport(
|
$this->genericImport(
|
||||||
Project::class,
|
Project::class,
|
||||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'client_id'],
|
['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',
|
'projects',
|
||||||
'number'
|
'number'
|
||||||
);
|
);
|
||||||
@ -453,7 +453,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
$this->genericNewClassImport(
|
$this->genericNewClassImport(
|
||||||
Product::class,
|
Product::class,
|
||||||
['user_id', 'company_id', 'hashed_id', 'id'],
|
['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'
|
'products'
|
||||||
);
|
);
|
||||||
$this->assertEquals(1, Product::count());
|
$this->assertEquals(1, Product::count());
|
||||||
@ -1149,7 +1149,7 @@ class ImportCompanyTest extends TestCase
|
|||||||
return $this->ids[$resource]["{$old}"];
|
return $this->ids[$resource]["{$old}"];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown() :void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$backup_json_file = sys_get_temp_dir().'/backup/backup.json';
|
$backup_json_file = sys_get_temp_dir().'/backup/backup.json';
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ use Illuminate\Support\Str;
|
|||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
|
||||||
class QuickbooksTest extends TestCase
|
class QuickbooksTest extends TestCase
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
@ -44,11 +43,11 @@ class QuickbooksTest extends TestCase
|
|||||||
|
|
||||||
public function testImportCallsGetDataOnceForClient()
|
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);
|
$hash = Str::random(32);
|
||||||
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
||||||
|
|
||||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
'column_map' => ['client' => ['mapping' => []]],
|
'column_map' => ['client' => ['mapping' => []]],
|
||||||
'skip_header' => true,
|
'skip_header' => true,
|
||||||
@ -68,19 +67,19 @@ class QuickbooksTest extends TestCase
|
|||||||
|
|
||||||
$base_transformer = new BaseTransformer($this->company);
|
$base_transformer = new BaseTransformer($this->company);
|
||||||
$this->assertTrue($base_transformer->hasClient('Sonnenschein Family Store'));
|
$this->assertTrue($base_transformer->hasClient('Sonnenschein Family Store'));
|
||||||
$contact = $base_transformer->getClient('Amy\'s Bird Sanctuary','');
|
$contact = $base_transformer->getClient('Amy\'s Bird Sanctuary', '');
|
||||||
$contact = Client::where('name','Amy\'s Bird Sanctuary')->first();
|
$contact = Client::where('name', 'Amy\'s Bird Sanctuary')->first();
|
||||||
$this->assertEquals('(650) 555-3311',$contact->phone);
|
$this->assertEquals('(650) 555-3311', $contact->phone);
|
||||||
$this->assertEquals('Birds@Intuit.com',$contact->contacts()->first()->email);
|
$this->assertEquals('Birds@Intuit.com', $contact->contacts()->first()->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testImportCallsGetDataOnceForProducts()
|
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);
|
$hash = Str::random(32);
|
||||||
Cache::put($hash.'-item', base64_encode(json_encode($data)), 360);
|
Cache::put($hash.'-item', base64_encode(json_encode($data)), 360);
|
||||||
|
|
||||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
'column_map' => ['item' => ['mapping' => []]],
|
'column_map' => ['item' => ['mapping' => []]],
|
||||||
'skip_header' => true,
|
'skip_header' => true,
|
||||||
@ -100,17 +99,17 @@ class QuickbooksTest extends TestCase
|
|||||||
|
|
||||||
$base_transformer = new BaseTransformer($this->company);
|
$base_transformer = new BaseTransformer($this->company);
|
||||||
$this->assertTrue($base_transformer->hasProduct('Gardening'));
|
$this->assertTrue($base_transformer->hasProduct('Gardening'));
|
||||||
$product = Product::where('product_key','Pest Control')->first();
|
$product = Product::where('product_key', 'Pest Control')->first();
|
||||||
$this->assertGreaterThanOrEqual( 35, $product->price);
|
$this->assertGreaterThanOrEqual(35, $product->price);
|
||||||
$this->assertLessThanOrEqual(0, $product->quantity);
|
$this->assertLessThanOrEqual(0, $product->quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testImportCallsGetDataOnceForInvoices()
|
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);
|
$hash = Str::random(32);
|
||||||
Cache::put($hash.'-invoice', base64_encode(json_encode($data)), 360);
|
Cache::put($hash.'-invoice', base64_encode(json_encode($data)), 360);
|
||||||
$quickbooks = Mockery::mock(Quickbooks::class,[[
|
$quickbooks = Mockery::mock(Quickbooks::class, [[
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
'column_map' => ['invoice' => ['mapping' => []]],
|
'column_map' => ['invoice' => ['mapping' => []]],
|
||||||
'skip_header' => true,
|
'skip_header' => true,
|
||||||
@ -125,10 +124,10 @@ class QuickbooksTest extends TestCase
|
|||||||
$this->assertGreaterThan(0, $quickbooks->entity_count['invoices']);
|
$this->assertGreaterThan(0, $quickbooks->entity_count['invoices']);
|
||||||
$base_transformer = new BaseTransformer($this->company);
|
$base_transformer = new BaseTransformer($this->company);
|
||||||
$this->assertTrue($base_transformer->hasInvoice(1007));
|
$this->assertTrue($base_transformer->hasInvoice(1007));
|
||||||
$invoice = Invoice::where('number',1012)->first();
|
$invoice = Invoice::where('number', 1012)->first();
|
||||||
$data = collect($data)->where('DocNumber','1012')->first();
|
$data = collect($data)->where('DocNumber', '1012')->first();
|
||||||
$this->assertGreaterThanOrEqual( $data['TotalAmt'], $invoice->amount);
|
$this->assertGreaterThanOrEqual($data['TotalAmt'], $invoice->amount);
|
||||||
$this->assertEquals( count($data['Line']) - 1 , count((array)$invoice->line_items));
|
$this->assertEquals(count($data['Line']) - 1, count((array)$invoice->line_items));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class InventoryManagementTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class InventoryManagementTest extends TestCase
|
|||||||
$invoice->company->track_inventory = true;
|
$invoice->company->track_inventory = true;
|
||||||
$invoice->push();
|
$invoice->push();
|
||||||
|
|
||||||
$invoice_item = new InvoiceItem;
|
$invoice_item = new InvoiceItem();
|
||||||
$invoice_item->type_id = 1;
|
$invoice_item->type_id = 1;
|
||||||
$invoice_item->product_key = $product->product_key;
|
$invoice_item->product_key = $product->product_key;
|
||||||
$invoice_item->notes = $product->notes;
|
$invoice_item->notes = $product->notes;
|
||||||
|
@ -35,7 +35,7 @@ class InvitationTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
// use RefreshDatabase;
|
// use RefreshDatabase;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class InvoiceAmountPaymentTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class InvoiceEmailTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -166,17 +166,17 @@ class InvoiceEmailTest extends TestCase
|
|||||||
$data = [
|
$data = [
|
||||||
"body" => "hey what's up",
|
"body" => "hey what's up",
|
||||||
"entity" => 'invoice',
|
"entity" => 'invoice',
|
||||||
"entity_id"=> $this->invoice->hashed_id,
|
"entity_id" => $this->invoice->hashed_id,
|
||||||
"subject"=> 'Reminder $number',
|
"subject" => 'Reminder $number',
|
||||||
"template"=> "first_custom"
|
"template" => "first_custom"
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/emails', $data);
|
])->postJson('/api/v1/emails', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
@ -194,10 +194,10 @@ class InvoiceEmailTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/emails', $data);
|
])->postJson('/api/v1/emails', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
@ -27,7 +27,7 @@ class InvoiceLinkTasksTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class InvoiceTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class InvoiceTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/invoices?mark_sent=true',$data)
|
])->postJson('/api/v1/invoices?mark_sent=true', $data)
|
||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
@ -39,7 +39,7 @@ class QuickbooksIngestTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testCanQuickbooksIngest(): void
|
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);
|
$hash = Str::random(32);
|
||||||
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
Cache::put($hash.'-client', base64_encode(json_encode($data)), 360);
|
||||||
QuickbooksIngest::dispatch([
|
QuickbooksIngest::dispatch([
|
||||||
@ -47,7 +47,7 @@ class QuickbooksIngestTest extends TestCase
|
|||||||
'column_map' => ['client' => ['mapping' => []]],
|
'column_map' => ['client' => ['mapping' => []]],
|
||||||
'skip_header' => true,
|
'skip_header' => true,
|
||||||
'import_types' => ['client'],
|
'import_types' => ['client'],
|
||||||
], $this->company )->handle();
|
], $this->company)->handle();
|
||||||
$this->assertTrue(Client::withTrashed()->where(['company_id' => $this->company->id, 'name' => "Freeman Sporting Goods"])->exists());
|
$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 DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class LoadTest extends TestCase
|
|||||||
|
|
||||||
public int $count = 1;
|
public int $count = 1;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
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->user_id = $user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $account->id;
|
$company_token->account_id = $account->id;
|
||||||
|
@ -29,7 +29,7 @@ class LoginTest extends TestCase
|
|||||||
{
|
{
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
Session::start();
|
Session::start();
|
||||||
@ -155,7 +155,7 @@ class LoginTest extends TestCase
|
|||||||
$account->default_company_id = $company->id;
|
$account->default_company_id = $company->id;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $user->id;
|
$company_token->user_id = $user->id;
|
||||||
$company_token->company_id = $company->id;
|
$company_token->company_id = $company->id;
|
||||||
$company_token->account_id = $account->id;
|
$company_token->account_id = $account->id;
|
||||||
@ -187,9 +187,9 @@ class LoginTest extends TestCase
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
])->postJson('/api/v1/login', $data);
|
])->postJson('/api/v1/login', $data);
|
||||||
|
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
@ -32,7 +32,7 @@ class MaxAmountTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class MaxAmountTest extends TestCase
|
|||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPurchaseOrderMaxAmount()
|
public function testPurchaseOrderMaxAmount()
|
||||||
{
|
{
|
||||||
$item = new InvoiceItem();
|
$item = new InvoiceItem();
|
||||||
$item->cost = 10000000000000000;
|
$item->cost = 10000000000000000;
|
||||||
|
@ -29,7 +29,7 @@ class MigrationTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -31,11 +31,12 @@ use Tests\TestCase;
|
|||||||
*/
|
*/
|
||||||
class MultiPaymentDeleteTest extends TestCase
|
class MultiPaymentDeleteTest extends TestCase
|
||||||
{
|
{
|
||||||
use DatabaseTransactions, MakesHash;
|
use DatabaseTransactions;
|
||||||
|
use MakesHash;
|
||||||
|
|
||||||
private $faker;
|
private $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class MultiPaymentDeleteTest extends TestCase
|
|||||||
$cu->is_admin = true;
|
$cu->is_admin = true;
|
||||||
$cu->save();
|
$cu->save();
|
||||||
|
|
||||||
$token = new CompanyToken;
|
$token = new CompanyToken();
|
||||||
$token->user_id = $user->id;
|
$token->user_id = $user->id;
|
||||||
$token->company_id = $company->id;
|
$token->company_id = $company->id;
|
||||||
$token->account_id = $account->id;
|
$token->account_id = $account->id;
|
||||||
|
@ -32,7 +32,7 @@ class PlanTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ class PlanTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->markTestSkipped();
|
$this->markTestSkipped();
|
||||||
|
|
||||||
$license = new License;
|
$license = new License();
|
||||||
$license->license_key = "1234";
|
$license->license_key = "1234";
|
||||||
$license->product_id = "3";
|
$license->product_id = "3";
|
||||||
$license->email = 'test@gmail.com';
|
$license->email = 'test@gmail.com';
|
||||||
|
@ -35,7 +35,7 @@ class NotificationTest extends TestCase
|
|||||||
|
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class NotificationTest extends TestCase
|
|||||||
'confirmation_code' => uniqid("st", true),
|
'confirmation_code' => uniqid("st", true),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $u->id;
|
$company_token->user_id = $u->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->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();
|
$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"];
|
$notifications->email = ["invoice_late_user","quote_approved_user"];
|
||||||
$company_user->update(['notifications' => (array)$notifications]);
|
$company_user->update(['notifications' => (array)$notifications]);
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class NotificationTest extends TestCase
|
|||||||
|
|
||||||
public function testNotificationFound()
|
public function testNotificationFound()
|
||||||
{
|
{
|
||||||
$notifications = new \stdClass;
|
$notifications = new \stdClass();
|
||||||
$notifications->email = ["inventory_all"];
|
$notifications->email = ["inventory_all"];
|
||||||
|
|
||||||
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
|
$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()
|
public function testAllNotificationsFires()
|
||||||
{
|
{
|
||||||
$notifications = new \stdClass;
|
$notifications = new \stdClass();
|
||||||
$notifications->email = ["all_notifications"];
|
$notifications->email = ["all_notifications"];
|
||||||
|
|
||||||
$p = Product::factory()->create([
|
$p = Product::factory()->create([
|
||||||
@ -146,7 +146,7 @@ class NotificationTest extends TestCase
|
|||||||
|
|
||||||
public function testAllNotificationsFiresForUser()
|
public function testAllNotificationsFiresForUser()
|
||||||
{
|
{
|
||||||
$notifications = new \stdClass;
|
$notifications = new \stdClass();
|
||||||
$notifications->email = ["all_user_notifications"];
|
$notifications->email = ["all_user_notifications"];
|
||||||
|
|
||||||
$p = Product::factory()->create([
|
$p = Product::factory()->create([
|
||||||
@ -168,7 +168,7 @@ class NotificationTest extends TestCase
|
|||||||
'confirmation_code' => uniqid("st", true),
|
'confirmation_code' => uniqid("st", true),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $u->id;
|
$company_token->user_id = $u->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->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"];
|
$notifications->email = ["all_user_notifications"];
|
||||||
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
|
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class WebhookTest extends TestCase
|
|||||||
|
|
||||||
private float $amount = 1285.13;
|
private float $amount = 1285.13;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class WebhookTest extends TestCase
|
|||||||
'is_recurring' => false,
|
'is_recurring' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
$payment_hash = new PaymentHash;
|
$payment_hash = new PaymentHash();
|
||||||
$payment_hash->hash = Str::random(32);
|
$payment_hash->hash = Str::random(32);
|
||||||
$payment_hash->data = $hash_data;
|
$payment_hash->data = $hash_data;
|
||||||
$payment_hash->fee_total = 0;
|
$payment_hash->fee_total = 0;
|
||||||
@ -113,7 +113,7 @@ class WebhookTest extends TestCase
|
|||||||
|
|
||||||
private function buildGateway()
|
private function buildGateway()
|
||||||
{
|
{
|
||||||
$config = new \stdClass;
|
$config = new \stdClass();
|
||||||
$config->merchantId = $this->merchant_id;
|
$config->merchantId = $this->merchant_id;
|
||||||
$config->status = 'activated';
|
$config->status = 'activated';
|
||||||
$config->consent = 'true';
|
$config->consent = 'true';
|
||||||
@ -122,7 +122,7 @@ class WebhookTest extends TestCase
|
|||||||
$config->returnMessage = 'true';
|
$config->returnMessage = 'true';
|
||||||
$config->paymentsReceivable = 'Yes';
|
$config->paymentsReceivable = 'Yes';
|
||||||
|
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway();
|
||||||
$cg->company_id = $this->company->id;
|
$cg->company_id = $this->company->id;
|
||||||
$cg->user_id = $this->user->id;
|
$cg->user_id = $this->user->id;
|
||||||
$cg->gateway_key = '80af24a6a691230bbec33e930ab40666';
|
$cg->gateway_key = '80af24a6a691230bbec33e930ab40666';
|
||||||
@ -133,8 +133,8 @@ class WebhookTest extends TestCase
|
|||||||
$cg->config = encrypt($config);
|
$cg->config = encrypt($config);
|
||||||
$cg->save();
|
$cg->save();
|
||||||
|
|
||||||
$fees_and_limits = new stdClass;
|
$fees_and_limits = new stdClass();
|
||||||
$fees_and_limits->{3} = new FeesAndLimits;
|
$fees_and_limits->{3} = new FeesAndLimits();
|
||||||
|
|
||||||
$cg->fees_and_limits = $fees_and_limits;
|
$cg->fees_and_limits = $fees_and_limits;
|
||||||
$cg->save();
|
$cg->save();
|
||||||
|
@ -110,7 +110,7 @@ class PaymentLinkTest extends TestCase
|
|||||||
|
|
||||||
$price = $target->link_service()->calculateUpgradePriceV2($recurring_invoice, $target);
|
$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);
|
$this->assertEquals(($target->price - $refund), $price);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class PaymentTermsApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithClientId()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -616,7 +616,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithNoInvoiecs()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -663,7 +663,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -945,7 +945,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1011,7 +1011,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1070,7 +1070,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1135,7 +1135,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1240,7 +1240,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1295,7 +1295,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithNoAmountField()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1361,7 +1361,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithZeroAmountField()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1420,7 +1420,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testPaymentForInvoicesFromDifferentClients()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client1->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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client2->id,
|
'client_id' => $client2->id,
|
||||||
@ -1496,7 +1496,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testPaymentWithSameInvoiceMultipleTimes()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client1->id,
|
'client_id' => $client1->id,
|
||||||
@ -1549,7 +1549,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithCredits()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1632,7 +1632,7 @@ class PaymentTest extends TestCase
|
|||||||
$settings = ClientSettings::defaults();
|
$settings = ClientSettings::defaults();
|
||||||
$settings->currency_id = '2';
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1693,7 +1693,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1778,7 +1778,7 @@ class PaymentTest extends TestCase
|
|||||||
{
|
{
|
||||||
$invoice = null;
|
$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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -1872,7 +1872,7 @@ class PaymentTest extends TestCase
|
|||||||
'date' => '2020/12/12',
|
'date' => '2020/12/12',
|
||||||
'number' => 'duplicate',
|
'number' => 'duplicate',
|
||||||
];
|
];
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
@ -1880,7 +1880,7 @@ sleep(1);
|
|||||||
])->postJson('/api/v1/payments', $data);
|
])->postJson('/api/v1/payments', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
|
@ -38,7 +38,7 @@ class PaymentV2Test extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class PaymentV2Test extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithCreditsThenDeletingInvoices()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -192,10 +192,10 @@ class PaymentV2Test extends TestCase
|
|||||||
|
|
||||||
$response = null;
|
$response = null;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||||
|
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
@ -258,7 +258,7 @@ class PaymentV2Test extends TestCase
|
|||||||
|
|
||||||
public function testStorePaymentWithCreditsThenDeletingInvoicesAndThenPayments()
|
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([
|
ClientContact::factory()->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
@ -329,10 +329,10 @@ class PaymentV2Test extends TestCase
|
|||||||
|
|
||||||
$response = null;
|
$response = null;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments?include=invoices', $data);
|
])->postJson('/api/v1/payments?include=invoices', $data);
|
||||||
|
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
@ -36,7 +36,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -94,10 +94,9 @@ class AutoUnappliedPaymentTest extends TestCase
|
|||||||
|
|
||||||
// nlog($invoice->balance);
|
// nlog($invoice->balance);
|
||||||
|
|
||||||
try{
|
try {
|
||||||
$invoice->service()->autoBill()->save();
|
$invoice->service()->autoBill()->save();
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
catch(\Exception $e){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +156,7 @@ class AutoUnappliedPaymentTest extends TestCase
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$invoice->service()->autoBill()->save();
|
$invoice->service()->autoBill()->save();
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
catch(\Exception $e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class CreditPaymentTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ class CreditPaymentTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
@ -29,7 +29,7 @@ class DeletePaymentTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -74,10 +74,10 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
@ -95,10 +95,10 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
@ -116,10 +116,10 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -147,10 +147,10 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
@ -176,10 +176,10 @@ class StorePaymentValidationTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments/', $data);
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class UnappliedPaymentDeleteTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -178,10 +178,10 @@ class UnappliedPaymentDeleteTest extends TestCase
|
|||||||
|
|
||||||
$response = null;
|
$response = null;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/payments', $data);
|
])->postJson('/api/v1/payments', $data);
|
||||||
|
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
@ -28,7 +28,7 @@ class UnappliedPaymentRefundTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockUnitData;
|
use MockUnitData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
class ExampleIntegrationTest extends TestCase
|
class ExampleIntegrationTest extends TestCase
|
||||||
{
|
{
|
||||||
use MakesInvoiceValues, MockAccountData;
|
use MakesInvoiceValues;
|
||||||
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@ use Tests\TestCase;
|
|||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
|
||||||
class CsvConversionTest extends TestCase
|
class CsvConversionTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
@ -27,28 +26,26 @@ class CsvConversionTest extends TestCase
|
|||||||
public function testExample()
|
public function testExample()
|
||||||
{
|
{
|
||||||
|
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
||||||
|
|
||||||
/* Set CSV parsing options */
|
/* Set CSV parsing options */
|
||||||
|
|
||||||
$reader->setDelimiter(',');
|
$reader->setDelimiter(',');
|
||||||
// $reader->setEnclosure('"');
|
// $reader->setEnclosure('"');
|
||||||
$reader->setSheetIndex(0);
|
$reader->setSheetIndex(0);
|
||||||
|
|
||||||
/* Load a CSV file and save as a XLS */
|
/* Load a CSV file and save as a XLS */
|
||||||
|
|
||||||
$spreadsheet = $reader->load(base_path().'/tests/Feature/Import/expenses.csv');
|
$spreadsheet = $reader->load(base_path().'/tests/Feature/Import/expenses.csv');
|
||||||
$writer = new Xlsx($spreadsheet);
|
$writer = new Xlsx($spreadsheet);
|
||||||
$writer->save(storage_path('/test.xlsx'));
|
$writer->save(storage_path('/test.xlsx'));
|
||||||
|
|
||||||
$spreadsheet->disconnectWorksheets();
|
$spreadsheet->disconnectWorksheets();
|
||||||
|
|
||||||
$this->assertTrue(file_exists(storage_path('/test.xlsx')));
|
$this->assertTrue(file_exists(storage_path('/test.xlsx')));
|
||||||
unlink(storage_path('/test.xlsx'));
|
unlink(storage_path('/test.xlsx'));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class PingTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->makeTestData();
|
$this->makeTestData();
|
||||||
|
@ -25,7 +25,7 @@ class PreviewTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class ProductTest extends TestCase
|
|||||||
|
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class ProjectApiTest extends TestCase
|
|||||||
|
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
event(new PurchaseOrderWasCreated($this->purchase_order, $this->company, Ninja::eventVars($this->company, $this->user)));
|
event(new PurchaseOrderWasCreated($this->purchase_order, $this->company, Ninja::eventVars($this->company, $this->user)));
|
||||||
|
|
||||||
$ar = new ActivityRepository();
|
$ar = new ActivityRepository();
|
||||||
$fields = new \stdClass;
|
$fields = new \stdClass();
|
||||||
$fields->user_id = $this->purchase_order->user_id;
|
$fields->user_id = $this->purchase_order->user_id;
|
||||||
$fields->vendor_id = $this->purchase_order->vendor_id;
|
$fields->vendor_id = $this->purchase_order->vendor_id;
|
||||||
$fields->company_id = $this->purchase_order->company_id;
|
$fields->company_id = $this->purchase_order->company_id;
|
||||||
@ -126,7 +126,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => 'archive',
|
'action' => 'archive',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => 'restore',
|
'action' => 'restore',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => 'delete',
|
'action' => 'delete',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => 'restore',
|
'action' => 'restore',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[],
|
'ids' => [],
|
||||||
'action' => 'archive',
|
'action' => 'archive',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
->assertStatus(302);
|
->assertStatus(302);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => '',
|
'action' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ class PurchaseOrderTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' =>[$po->hashed_id],
|
'ids' => [$po->hashed_id],
|
||||||
'action' => 'molly',
|
'action' => 'molly',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class QuoteReminderTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class QuoteReminderTest extends TestCase
|
|||||||
|
|
||||||
$this->token = \Illuminate\Support\Str::random(64);
|
$this->token = \Illuminate\Support\Str::random(64);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $this->user->id;
|
$company_token->user_id = $this->user->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->id;
|
$company_token->account_id = $this->account->id;
|
||||||
|
@ -37,7 +37,7 @@ class QuoteTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ class QuoteTest extends TestCase
|
|||||||
'client_id' => $c->id,
|
'client_id' => $c->id,
|
||||||
'status_id' => 2,
|
'status_id' => 2,
|
||||||
'date' => now(),
|
'date' => now(),
|
||||||
'line_items' =>[
|
'line_items' => [
|
||||||
[
|
[
|
||||||
'type_id' => '2',
|
'type_id' => '2',
|
||||||
'cost' => 200,
|
'cost' => 200,
|
||||||
|
@ -34,7 +34,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
'client_id' => $this->client->hashed_id,
|
'client_id' => $this->client->hashed_id,
|
||||||
'number' => '123321',
|
'number' => '123321',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'remaining_cycles' =>5,
|
'remaining_cycles' => 5,
|
||||||
'currency_id' => 34545435425
|
'currency_id' => 34545435425
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
'client_id' => $this->client->hashed_id,
|
'client_id' => $this->client->hashed_id,
|
||||||
'number' => '123321',
|
'number' => '123321',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'remaining_cycles' =>5,
|
'remaining_cycles' => 5,
|
||||||
'currency_id' => 1
|
'currency_id' => 1
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
'client_id' => $this->client->hashed_id,
|
'client_id' => $this->client->hashed_id,
|
||||||
'number' => '123321',
|
'number' => '123321',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'remaining_cycles' =>5,
|
'remaining_cycles' => 5,
|
||||||
'currency_id' => null
|
'currency_id' => null
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
'client_id' => $this->client->hashed_id,
|
'client_id' => $this->client->hashed_id,
|
||||||
'number' => '123321',
|
'number' => '123321',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'remaining_cycles' =>5,
|
'remaining_cycles' => 5,
|
||||||
'currency_id' => ""
|
'currency_id' => ""
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ class RecurringExpenseApiTest extends TestCase
|
|||||||
'client_id' => $this->client->hashed_id,
|
'client_id' => $this->client->hashed_id,
|
||||||
'number' => '123321',
|
'number' => '123321',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'remaining_cycles' =>5,
|
'remaining_cycles' => 5,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
|
@ -44,7 +44,7 @@ class RecurringInvoiceTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -106,11 +106,11 @@ class RecurringInvoiceTest extends TestCase
|
|||||||
])->postJson('/api/v1/recurring_invoices/bulk', $data)
|
])->postJson('/api/v1/recurring_invoices/bulk', $data)
|
||||||
->assertStatus(200);
|
->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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class RecurringInvoicesCronTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class RecurringQuoteTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class RecurringQuotesTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class RefundTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class RefundTest extends TestCase
|
|||||||
|
|
||||||
$payment_id = $arr['data']['id'];
|
$payment_id = $arr['data']['id'];
|
||||||
|
|
||||||
$item = new InvoiceItem;
|
$item = new InvoiceItem();
|
||||||
$item->cost = 300;
|
$item->cost = 300;
|
||||||
$item->quantity = 1;
|
$item->quantity = 1;
|
||||||
|
|
||||||
@ -792,7 +792,7 @@ class RefundTest extends TestCase
|
|||||||
'balance' => 1000,
|
'balance' => 1000,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$item = new InvoiceItem;
|
$item = new InvoiceItem();
|
||||||
$item->cost = 1000;
|
$item->cost = 1000;
|
||||||
$item->quantity = 1;
|
$item->quantity = 1;
|
||||||
|
|
||||||
@ -825,9 +825,9 @@ class RefundTest extends TestCase
|
|||||||
$this->assertNotNull($c);
|
$this->assertNotNull($c);
|
||||||
$this->assertEquals(2, $c->status_id);
|
$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 = [
|
$data = [
|
||||||
'amount' => 900,
|
'amount' => 900,
|
||||||
|
@ -42,7 +42,7 @@ class ReminderTest extends TestCase
|
|||||||
|
|
||||||
public $faker;
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class ReminderTest extends TestCase
|
|||||||
|
|
||||||
$this->token = \Illuminate\Support\Str::random(64);
|
$this->token = \Illuminate\Support\Str::random(64);
|
||||||
|
|
||||||
$company_token = new CompanyToken;
|
$company_token = new CompanyToken();
|
||||||
$company_token->user_id = $this->user->id;
|
$company_token->user_id = $this->user->id;
|
||||||
$company_token->company_id = $this->company->id;
|
$company_token->company_id = $this->company->id;
|
||||||
$company_token->account_id = $this->account->id;
|
$company_token->account_id = $this->account->id;
|
||||||
@ -228,8 +228,7 @@ class ReminderTest extends TestCase
|
|||||||
$invoice = $invoice->fresh();
|
$invoice = $invoice->fresh();
|
||||||
|
|
||||||
$x = (bool)$invoice->reminder1_sent;
|
$x = (bool)$invoice->reminder1_sent;
|
||||||
}
|
} while($x === false);
|
||||||
while($x === false);
|
|
||||||
|
|
||||||
$this->assertNotNull($invoice->reminder_last_sent);
|
$this->assertNotNull($invoice->reminder_last_sent);
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ class ReminderTest extends TestCase
|
|||||||
public function testReminderInThePast()
|
public function testReminderInThePast()
|
||||||
{
|
{
|
||||||
|
|
||||||
$translations = new \stdClass;
|
$translations = new \stdClass();
|
||||||
$translations->late_fee_added = "Fee added :date";
|
$translations->late_fee_added = "Fee added :date";
|
||||||
|
|
||||||
$settings = $this->company->settings;
|
$settings = $this->company->settings;
|
||||||
@ -377,7 +376,7 @@ class ReminderTest extends TestCase
|
|||||||
public function testsForTranslationsInReminders()
|
public function testsForTranslationsInReminders()
|
||||||
{
|
{
|
||||||
|
|
||||||
$translations = new \stdClass;
|
$translations = new \stdClass();
|
||||||
$translations->late_fee_added = "Fee added :date";
|
$translations->late_fee_added = "Fee added :date";
|
||||||
|
|
||||||
$settings = $this->company->settings;
|
$settings = $this->company->settings;
|
||||||
@ -502,7 +501,7 @@ class ReminderTest extends TestCase
|
|||||||
|
|
||||||
$travel_date = Carbon::parse($this->invoice->next_send_date);
|
$travel_date = Carbon::parse($this->invoice->next_send_date);
|
||||||
$x = false;
|
$x = false;
|
||||||
for($x=0; $x<50; $x++) {
|
for($x = 0; $x < 50; $x++) {
|
||||||
|
|
||||||
(new ReminderJob())->handle();
|
(new ReminderJob())->handle();
|
||||||
|
|
||||||
@ -511,7 +510,7 @@ class ReminderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertNotNull($this->invoice->reminder1_sent);
|
$this->assertNotNull($this->invoice->reminder1_sent);
|
||||||
$this->assertNotNull($this->invoice->reminder_last_sent);
|
$this->assertNotNull($this->invoice->reminder_last_sent);
|
||||||
$x=true;
|
$x = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class ReverseInvoiceTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -107,12 +107,12 @@ class SchedulerTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/task_schedulers', $data);
|
])->postJson('/api/v1/task_schedulers', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
|
|
||||||
@ -150,12 +150,12 @@ class SchedulerTest extends TestCase
|
|||||||
|
|
||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->postJson('/api/v1/task_schedulers', $data);
|
])->postJson('/api/v1/task_schedulers', $data);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
@ -770,7 +770,7 @@ class SchedulerTest extends TestCase
|
|||||||
'name' => 'A different Name',
|
'name' => 'A different Name',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'next_run' => now()->addDays(2)->format('Y-m-d'),
|
'next_run' => now()->addDays(2)->format('Y-m-d'),
|
||||||
'template' =>'client_statement',
|
'template' => 'client_statement',
|
||||||
'parameters' => [],
|
'parameters' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ class SchedulerTest extends TestCase
|
|||||||
'name' => 'A different Name',
|
'name' => 'A different Name',
|
||||||
'frequency_id' => 5,
|
'frequency_id' => 5,
|
||||||
'next_run' => now()->addDays(2)->format('Y-m-d'),
|
'next_run' => now()->addDays(2)->format('Y-m-d'),
|
||||||
'template' =>'client_statement',
|
'template' => 'client_statement',
|
||||||
'parameters' => [],
|
'parameters' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class SearchApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class ShopInvoiceTest extends TestCase
|
|||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
protected $faker;
|
protected $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class SystemLogApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class TaskApiTest extends TestCase
|
|||||||
|
|
||||||
private $faker;
|
private $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class TaskApiTest extends TestCase
|
|||||||
/*Flag which helps us know if there is a NEXT timelog*/
|
/*Flag which helps us know if there is a NEXT timelog*/
|
||||||
$next = false;
|
$next = false;
|
||||||
/* If there are more than 1 time log in the array, ensure the last timestamp is not zero*/
|
/* If there are more than 1 time log in the array, ensure the last timestamp is not zero*/
|
||||||
if (count($new_array) >1 && $array[1] == 0) {
|
if (count($new_array) > 1 && $array[1] == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ class TaskApiTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find the next time log value - if it exists */
|
/* Find the next time log value - if it exists */
|
||||||
if (array_key_exists($key+1, $new_array)) {
|
if (array_key_exists($key + 1, $new_array)) {
|
||||||
$next = $new_array[$key+1];
|
$next = $new_array[$key + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check the next time log and ensure the start time is GREATER than the end time of the previous record */
|
/* check the next time log and ensure the start time is GREATER than the end time of the previous record */
|
||||||
|
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