PHP CS Fixer

This commit is contained in:
David Bomba 2024-08-22 16:57:52 +10:00
parent 74411da11f
commit 8160af4ef4
231 changed files with 2586 additions and 2582 deletions

View File

@ -43,12 +43,12 @@ class ApplePayDomainMerchantUrlTest extends TestCase
$this->markTestSkipped('Skip test no company gateways installed');
// }
$config = new \stdClass;
$config = new \stdClass();
$config->publishableKey = 'pk_test';
$config->apiKey = 'sk_test';
$config->appleDomainVerification = 'merchant_id';
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -161,7 +161,7 @@ class BaseApiTest extends TestCase
$user_id = $owner_user->id;
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $owner_user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $this->account->id;
@ -186,7 +186,7 @@ class BaseApiTest extends TestCase
$this->low_token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $lower_permission_user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;
@ -326,7 +326,7 @@ class BaseApiTest extends TestCase
'company_id' => $company->id,
]);
$gs = new GroupSetting;
$gs = new GroupSetting();
$gs->name = 'Test';
$gs->company_id = $client->company_id;
$gs->settings = ClientSettings::buildClientSettings($company->settings, $client->settings);
@ -372,7 +372,7 @@ class BaseApiTest extends TestCase
'company_id' => $company->id,
]);
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $company->id;
$cg->user_id = $user_id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -733,7 +733,7 @@ $this->assertCount(7, $arr['data']);
$different_company_token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;
@ -931,7 +931,7 @@ $this->assertCount(7, $arr['data']);
public function testClientSettingsSave()
{
$std = new \stdClass;
$std = new \stdClass();
$std->entity = 'App\\Models\\Client';
$std->currency_id = 3;
@ -945,7 +945,7 @@ $this->assertCount(7, $arr['data']);
public function testClientSettingsSave2()
{
$std = new \stdClass;
$std = new \stdClass();
$std->entity = 'App\\Models\\Client';
$std->industry_id = '';
$std->size_id = '';
@ -1022,7 +1022,7 @@ $this->assertCount(7, $arr['data']);
$repository = app()->make($repository_name);
$repository->import_mode = true;
$_syn_request_class = new $request_name;
$_syn_request_class = new $request_name();
$_syn_request_class->setContainer(app());
$_syn_request_class->initialize($data);
$_syn_request_class->prepareForValidation();

View File

@ -87,7 +87,7 @@ class ClientGatewayTokenApiTest extends TestCase
//disable ach here
$json_config = json_decode(config('ninja.testvars.stripe'));
$this->cg = new CompanyGateway;
$this->cg = new CompanyGateway();
$this->cg->company_id = $this->company->id;
$this->cg->user_id = $this->user->id;
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -41,8 +41,9 @@ class ClientModelTest extends TestCase
$this->markTestSkipped('Skip test no company gateways installed');
}
if(CompanyGateway::count() == 0)
if(CompanyGateway::count() == 0) {
$this->markTestSkipped('Skip test no company gateways installed');
}
}

View File

@ -25,9 +25,10 @@ use App\Utils\Traits\AppSetup;
use Faker\Factory;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Livewire\Livewire;
use function now;
use Tests\TestCase;
use function now;
class CreditsTest extends TestCase
{
use DatabaseTransactions;

View File

@ -570,7 +570,7 @@ class ClientTest extends TestCase
'is_locked' => 0,
]);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;
@ -625,7 +625,7 @@ class ClientTest extends TestCase
'is_locked' => 0,
]);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;

View File

@ -164,7 +164,7 @@ class CompanyGatewayApiTest extends TestCase
public function testCompanyGatewayFeesAndLimitsSuccess()
{
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee = (array) $fee;
@ -224,7 +224,7 @@ class CompanyGatewayApiTest extends TestCase
public function testCompanyGatewayFeesAndLimitsFails()
{
$fee_and_limit['bank_transfer'] = new FeesAndLimits;
$fee_and_limit['bank_transfer'] = new FeesAndLimits();
$fee_and_limit['bank_transfer']->adjust_fee_percent = 10;
@ -250,7 +250,7 @@ class CompanyGatewayApiTest extends TestCase
'max_limit' => 2,
];
$fal = (array) new FeesAndLimits;
$fal = (array) new FeesAndLimits();
$new_arr = array_replace($fal, $arr);
@ -261,7 +261,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeeAmountCalcuation()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
// $fee->fee_percent = 2;
// $fee->fee_tax_name1 = 'GST';
@ -294,7 +294,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentCalcuation()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
//$fee->fee_amount = 10;
$fee->fee_percent = 2;
// $fee->fee_tax_name1 = 'GST';
@ -327,7 +327,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountCalcuation()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
$fee->fee_percent = 2;
// $fee->fee_tax_name1 = 'GST';
@ -360,7 +360,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercent()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 0;
$fee->fee_percent = 100;
$fee->adjust_fee_percent = false;
@ -393,7 +393,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountCalcuationOneHundredPercentVariationOne()
{
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 0;
$fee->fee_percent = 10;
@ -424,7 +424,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuation()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
// $fee->fee_percent = 2;
$fee->fee_tax_name1 = 'GST';
@ -457,7 +457,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountAndTaxCalcuationInclusiveTaxes()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
// $fee->fee_percent = 2;
$fee->fee_tax_name1 = 'GST';
@ -490,7 +490,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuation()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
// $fee->fee_percent = 2;
$fee->fee_tax_name1 = 'GST';
@ -525,7 +525,7 @@ class CompanyGatewayApiTest extends TestCase
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuationWithFeeCap()
{
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
$fee = new FeesAndLimits;
$fee = new FeesAndLimits();
$fee->fee_amount = 10;
// $fee->fee_percent = 2;
$fee->fee_tax_name1 = 'GST';

View File

@ -91,7 +91,7 @@ class CompanyGatewayResolutionTest extends TestCase
//disable ach here
$json_config = json_decode(config('ninja.testvars.stripe'));
$this->cg = new CompanyGateway;
$this->cg = new CompanyGateway();
$this->cg->company_id = $this->company->id;
$this->cg->user_id = $this->user->id;
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -185,7 +185,7 @@ class CompanyGatewayResolutionTest extends TestCase
//disable ach here
$json_config = json_decode(config('ninja.testvars.stripe'));
$this->cg = new CompanyGateway;
$this->cg = new CompanyGateway();
$this->cg->company_id = $this->company->id;
$this->cg->user_id = $this->user->id;
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -237,7 +237,7 @@ class CompanyGatewayResolutionTest extends TestCase
//disable ach here
$json_config = json_decode(config('ninja.testvars.stripe'));
$this->cg = new CompanyGateway;
$this->cg = new CompanyGateway();
$this->cg->company_id = $this->company->id;
$this->cg->user_id = $this->user->id;
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -80,7 +80,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -152,7 +152,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -191,7 +191,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -237,7 +237,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -285,7 +285,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -8,6 +8,7 @@
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace Tests\Feature;
use App\DataMapper\CompanySettings;

View File

@ -88,7 +88,7 @@ class FatturaPATest extends TestCase
'settings' => $client_settings,
]);
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->product_key = "Product Key";
$item->notes = "Product Description";
$item->cost = 10;
@ -126,11 +126,12 @@ class FatturaPATest extends TestCase
$this->assertInstanceOf(FatturaElettronicaBody::class, $fe->FatturaElettronicaBody[0]);
$this->assertInstanceOf(FatturaElettronicaHeader::class, $fe->FatturaElettronicaHeader);
$e = new EInvoice;
$e = new EInvoice();
$errors = $e->validate($fe);
if(count($errors) > 0)
if(count($errors) > 0) {
nlog($errors);
}
$this->assertCount(0, $errors);

View File

@ -86,7 +86,7 @@ class PeppolTest extends TestCase
$pm->PayeeFinancialAccount = $pfa;
$einvoice->PaymentMeans[] = $pm;
$stub = new \stdClass;
$stub = new \stdClass();
$stub->Invoice = $einvoice;
$company = Company::factory()->create([

View File

@ -225,7 +225,7 @@ class ReportCsvGenerationTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;

View File

@ -125,8 +125,8 @@ class GoCardlessInstantBankPaymentTest extends TestCase
public function testInvoiceDelayedNotificationPayment()
{
$gocardlesspayment = new \stdClass;
$links = new \stdClass;
$gocardlesspayment = new \stdClass();
$links = new \stdClass();
$links->mandate = "my_mandate";
$gocardlesspayment->links = $links;
$gocardlesspayment->id = "gocardless_payment_id";
@ -172,7 +172,7 @@ class GoCardlessInstantBankPaymentTest extends TestCase
$this->assertEquals($invoice->balance, $test_invoice_object->amount);
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'b9886f9257f0c6ee7c302f1c74475f6c';

View File

@ -41,7 +41,7 @@ class GroupSettingTest extends TestCase
public function testCastingMagic()
{
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$settings->tax_name1 = '';
$settings->tax_rate1 = 0;
@ -51,7 +51,7 @@ class GroupSettingTest extends TestCase
$this->assertEquals("", $settings->tax_name1);
$settings = null;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$settings->tax_name1 = "1";
$settings->tax_rate1 = 0;
@ -63,7 +63,7 @@ class GroupSettingTest extends TestCase
$settings = $s->cast($settings)->toArray();
$this->assertEquals("1", $settings['tax_name1']);
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$settings->tax_name1 = [];
$settings->tax_rate1 = 0;
@ -75,9 +75,9 @@ class GroupSettingTest extends TestCase
$settings = $s->cast($settings)->toArray();
$this->assertEquals("", $settings['tax_name1']);
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$settings->tax_name1 = new \stdClass;
$settings->tax_name1 = new \stdClass();
$settings->tax_rate1 = 0;
$settings = $s->cast($settings)->toObject();
@ -94,7 +94,7 @@ class GroupSettingTest extends TestCase
public function testTaxNameInGroupFilters()
{
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$settings->tax_name1 = '';
$settings->tax_rate1 = 0;
@ -120,7 +120,7 @@ class GroupSettingTest extends TestCase
public function testAddGroupFilters()
{
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$data = [
@ -156,7 +156,7 @@ class GroupSettingTest extends TestCase
public function testAddGroupSettings()
{
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$data = [
@ -179,7 +179,7 @@ class GroupSettingTest extends TestCase
public function testArchiveGroupSettings()
{
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$data = [

View File

@ -28,7 +28,8 @@ class ImportQuickbooksControllerTest extends TestCase
private $mock;
private $state;
protected function setUp(): void {
protected function setUp(): void
{
parent::setUp();
@ -118,9 +119,11 @@ class ImportQuickbooksControllerTest extends TestCase
//Bus::assertDispatched(\App\Jobs\Import\QuickbooksIngest::class);
}
protected function setUpTestData($file) {
protected function setUpTestData($file)
{
$data = json_decode(
file_get_contents(base_path("tests/Mock/Quickbooks/Data/$file.json")),true
file_get_contents(base_path("tests/Mock/Quickbooks/Data/$file.json")),
true
);
return $data;

View File

@ -93,7 +93,7 @@ class ImportCompanyTest extends TestCase
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
$zip = new \ZipArchive;
$zip = new \ZipArchive();
$res = $zip->open($backup_json_file_zip);
if ($res === true) {
$zip->extractTo(sys_get_temp_dir());
@ -117,7 +117,7 @@ class ImportCompanyTest extends TestCase
{
$backup_json_file_zip = base_path().'/tests/Feature/Import/backup.zip';
$zip = new \ZipArchive;
$zip = new \ZipArchive();
$res = $zip->open($backup_json_file_zip);
if ($res === true) {

View File

@ -18,7 +18,6 @@ use Illuminate\Support\Str;
use ReflectionClass;
use Illuminate\Support\Facades\Auth;
class QuickbooksTest extends TestCase
{
use MakesHash;

View File

@ -62,7 +62,7 @@ class InventoryManagementTest extends TestCase
$invoice->company->track_inventory = true;
$invoice->push();
$invoice_item = new InvoiceItem;
$invoice_item = new InvoiceItem();
$invoice_item->type_id = 1;
$invoice_item->product_key = $product->product_key;
$invoice_item->notes = $product->notes;

View File

@ -74,7 +74,7 @@ class LoadTest extends TestCase
]);
}
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;

View File

@ -155,7 +155,7 @@ class LoginTest extends TestCase
$account->default_company_id = $company->id;
$account->save();
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $company->id;
$company_token->account_id = $account->id;

View File

@ -31,7 +31,8 @@ use Tests\TestCase;
*/
class MultiPaymentDeleteTest extends TestCase
{
use DatabaseTransactions, MakesHash;
use DatabaseTransactions;
use MakesHash;
private $faker;
@ -63,7 +64,7 @@ class MultiPaymentDeleteTest extends TestCase
$cu->is_admin = true;
$cu->save();
$token = new CompanyToken;
$token = new CompanyToken();
$token->user_id = $user->id;
$token->company_id = $company->id;
$token->account_id = $account->id;

View File

@ -93,7 +93,7 @@ class PlanTest extends TestCase
{
$this->markTestSkipped();
$license = new License;
$license = new License();
$license->license_key = "1234";
$license->product_id = "3";
$license->email = 'test@gmail.com';

View File

@ -56,7 +56,7 @@ class NotificationTest extends TestCase
'confirmation_code' => uniqid("st", true),
]);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $u->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;
@ -76,7 +76,7 @@ class NotificationTest extends TestCase
$company_user = CompanyUser::where('user_id', $u->id)->where('company_id', $this->company->id)->first();
$notifications = new \stdClass;
$notifications = new \stdClass();
$notifications->email = ["invoice_late_user","quote_approved_user"];
$company_user->update(['notifications' => (array)$notifications]);
@ -106,7 +106,7 @@ class NotificationTest extends TestCase
public function testNotificationFound()
{
$notifications = new \stdClass;
$notifications = new \stdClass();
$notifications->email = ["inventory_all"];
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);
@ -130,7 +130,7 @@ class NotificationTest extends TestCase
public function testAllNotificationsFires()
{
$notifications = new \stdClass;
$notifications = new \stdClass();
$notifications->email = ["all_notifications"];
$p = Product::factory()->create([
@ -146,7 +146,7 @@ class NotificationTest extends TestCase
public function testAllNotificationsFiresForUser()
{
$notifications = new \stdClass;
$notifications = new \stdClass();
$notifications->email = ["all_user_notifications"];
$p = Product::factory()->create([
@ -168,7 +168,7 @@ class NotificationTest extends TestCase
'confirmation_code' => uniqid("st", true),
]);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $u->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;
@ -192,7 +192,7 @@ class NotificationTest extends TestCase
]);
$notifications = new \stdClass;
$notifications = new \stdClass();
$notifications->email = ["all_user_notifications"];
$this->user->company_users()->where('company_id', $this->company->id)->update(['notifications' => (array)$notifications]);

View File

@ -82,7 +82,7 @@ class WebhookTest extends TestCase
'is_recurring' => false,
];
$payment_hash = new PaymentHash;
$payment_hash = new PaymentHash();
$payment_hash->hash = Str::random(32);
$payment_hash->data = $hash_data;
$payment_hash->fee_total = 0;
@ -113,7 +113,7 @@ class WebhookTest extends TestCase
private function buildGateway()
{
$config = new \stdClass;
$config = new \stdClass();
$config->merchantId = $this->merchant_id;
$config->status = 'activated';
$config->consent = 'true';
@ -122,7 +122,7 @@ class WebhookTest extends TestCase
$config->returnMessage = 'true';
$config->paymentsReceivable = 'Yes';
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = '80af24a6a691230bbec33e930ab40666';
@ -133,8 +133,8 @@ class WebhookTest extends TestCase
$cg->config = encrypt($config);
$cg->save();
$fees_and_limits = new stdClass;
$fees_and_limits->{3} = new FeesAndLimits;
$fees_and_limits = new stdClass();
$fees_and_limits->{3} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits;
$cg->save();

View File

@ -96,8 +96,7 @@ class AutoUnappliedPaymentTest extends TestCase
try {
$invoice->service()->autoBill()->save();
}
catch(\Exception $e){
} catch(\Exception $e) {
}
@ -157,8 +156,7 @@ class AutoUnappliedPaymentTest extends TestCase
try {
$invoice->service()->autoBill()->save();
}
catch(\Exception $e) {
} catch(\Exception $e) {
}

View File

@ -20,7 +20,8 @@ use Tests\TestCase;
class ExampleIntegrationTest extends TestCase
{
use MakesInvoiceValues, MockAccountData;
use MakesInvoiceValues;
use MockAccountData;
protected function setUp(): void
{

View File

@ -16,7 +16,6 @@ use Tests\TestCase;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class CsvConversionTest extends TestCase
{
protected function setUp(): void
@ -50,5 +49,3 @@ class CsvConversionTest extends TestCase
}
}

View File

@ -67,7 +67,7 @@ class PurchaseOrderTest extends TestCase
event(new PurchaseOrderWasCreated($this->purchase_order, $this->company, Ninja::eventVars($this->company, $this->user)));
$ar = new ActivityRepository();
$fields = new \stdClass;
$fields = new \stdClass();
$fields->user_id = $this->purchase_order->user_id;
$fields->vendor_id = $this->purchase_order->vendor_id;
$fields->company_id = $this->purchase_order->company_id;

View File

@ -112,7 +112,7 @@ class QuoteReminderTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;

View File

@ -82,7 +82,7 @@ class RefundTest extends TestCase
$payment_id = $arr['data']['id'];
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->cost = 300;
$item->quantity = 1;
@ -792,7 +792,7 @@ class RefundTest extends TestCase
'balance' => 1000,
]);
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->cost = 1000;
$item->quantity = 1;

View File

@ -112,7 +112,7 @@ class ReminderTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;
@ -228,8 +228,7 @@ class ReminderTest extends TestCase
$invoice = $invoice->fresh();
$x = (bool)$invoice->reminder1_sent;
}
while($x === false);
} while($x === false);
$this->assertNotNull($invoice->reminder_last_sent);
@ -339,7 +338,7 @@ class ReminderTest extends TestCase
public function testReminderInThePast()
{
$translations = new \stdClass;
$translations = new \stdClass();
$translations->late_fee_added = "Fee added :date";
$settings = $this->company->settings;
@ -377,7 +376,7 @@ class ReminderTest extends TestCase
public function testsForTranslationsInReminders()
{
$translations = new \stdClass;
$translations = new \stdClass();
$translations->late_fee_added = "Fee added :date";
$settings = $this->company->settings;

View File

@ -832,7 +832,7 @@ class TemplateTest extends TestCase
$design->user_id = $this->invoice->user_id;
$design->company_id = $this->invoice->company_id;
$design_object = new \stdClass;
$design_object = new \stdClass();
$design_object->includes = '';
$design_object->header = '';
$design_object->body = $this->body;

View File

@ -33,8 +33,9 @@ class UpdateExchangeRatesTest extends TestCase
{
parent::setUp();
if(empty(config('ninja.currency_converter_api_key')))
if(empty(config('ninja.currency_converter_api_key'))) {
$this->markTestSkipped("no currency key set");
}
}

View File

@ -480,7 +480,7 @@ class UserTest extends TestCase
'account_id' => $this->account->id,
]);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $company2->id;
$company_token->account_id = $this->account->id;

View File

@ -109,7 +109,7 @@ class CompanyLedgerTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;

View File

@ -18,7 +18,6 @@ use Tests\TestCase;
*/
class AccountSummaryTest extends TestCase
{
private $data = [
[
"CONTAINER" => "bank",
@ -164,7 +163,7 @@ class AccountSummaryTest extends TestCase
private function transformSummary($summary)
{
$dto = new \stdClass;
$dto = new \stdClass();
$dto->id = $summary['id'] ?? 0;
$dto->account_type = $summary['CONTAINER'] ?? '';

View File

@ -115,7 +115,7 @@ class DownloadHistoricalInvoiceTest extends TestCase
{
$activity_repo = new ActivityRepository();
$obj = new \stdClass;
$obj = new \stdClass();
$obj->invoice_id = $this->invoice->id;
$obj->user_id = $this->invoice->user_id;
$obj->company_id = $this->company->id;

View File

@ -118,7 +118,7 @@ class FACT1Test extends TestCase
$items = [];
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->cost = 10;
$item->quantity = 10;
$item->tax_name1 = 'VAT';
@ -258,29 +258,28 @@ class FACT1Test extends TestCase
$lmt->LineExtensionAmount = $lea;
$tea = new TaxExclusiveAmount;
$tea = new TaxExclusiveAmount();
$tea->amount = $taxable;
$tea->currencyID = $_invoice->client->currency()->code;
$lmt->TaxExclusiveAmount = $tea;
$tia = new TaxInclusiveAmount;
$tia = new TaxInclusiveAmount();
$tia->amount = $_invoice->amount;
$tia->currencyID = $_invoice->client->currency()->code;
$lmt->TaxInclusiveAmount = $tia;
$pa = new PayableAmount;
$pa = new PayableAmount();
$pa->amount = $_invoice->amount;
$pa->currencyID = $_invoice->client->currency()->code;
$lmt->PayableAmount = $pa;
$invoice->LegalMonetaryTotal = $lmt;
foreach($_invoice->line_items as $key => $item)
{
foreach($_invoice->line_items as $key => $item) {
$invoice_line = new InvoiceLine;
$invoice_line = new InvoiceLine();
$invoice_line->ID = $key++;
$iq = new InvoicedQuantity();
@ -294,7 +293,7 @@ class FACT1Test extends TestCase
$ctc = new ClassifiedTaxCategory();
$ctc->ID = 'S';
$i = new Item;
$i = new Item();
$i->Description = $item->notes;
$i->Name = $item->product_key;
@ -311,7 +310,7 @@ class FACT1Test extends TestCase
$invoice_line->Item = $i;
$lea = new LineExtensionAmount;
$lea = new LineExtensionAmount();
$lea->amount = $item->line_total;
$lea->currencyID = $_invoice->client->currency()->code;

View File

@ -37,9 +37,10 @@ class StorecoveTest extends TestCase
$this->makeTestData();
if (config('ninja.testvars.travis') !== false || !config('ninja.storecove_api_key'))
if (config('ninja.testvars.travis') !== false || !config('ninja.storecove_api_key')) {
$this->markTestSkipped("do not run in CI");
}
}
// public function testCreateLegalEntity()
// {
@ -1244,8 +1245,9 @@ $x = '<?xml version="1.0" encoding="utf-8"?>
$e_invoice = new \InvoiceNinja\EInvoice\Models\Peppol\Invoice();
$stub = json_decode('{"Invoice":{"Note":"Nooo","PaymentMeans":[{"ID":{"value":"afdasfasdfasdfas"},"PayeeFinancialAccount":{"Name":"PFA-NAME","ID":{"value":"DE89370400440532013000"},"AliasName":"PFA-Alias","AccountTypeCode":{"value":"CHECKING"},"AccountFormatCode":{"value":"IBAN"},"CurrencyCode":{"value":"EUR"},"FinancialInstitutionBranch":{"ID":{"value":"DEUTDEMMXXX"},"Name":"Deutsche Bank"}}}]}}');
foreach($stub as $key => $value)
foreach($stub as $key => $value) {
$e_invoice->{$key} = $value;
}
$invoice->e_invoice = $e_invoice;
$invoice->save();

View File

@ -46,7 +46,7 @@ class SendFailedEmailsTest extends TestCase
'body' => '',
];
$system_log = new SystemLog;
$system_log = new SystemLog();
$system_log->company_id = $this->invoice->company_id;
$system_log->client_id = $this->invoice->client_id;
$system_log->category_id = SystemLog::CATEGORY_MAIL;

View File

@ -19,7 +19,8 @@ class QuickBooksServiceTest extends TestCase
parent::setUp();
$this->markTestSkipped("no bueno");
$data = json_decode(
file_get_contents(base_path('tests/Mock/Quickbooks/Data/customers.json')),true
file_get_contents(base_path('tests/Mock/Quickbooks/Data/customers.json')),
true
);
$count = count($data);
$sdkMock = Mockery::mock(\stdClass::class);

View File

@ -102,7 +102,7 @@ class UpdateCompanyUserTest extends TestCase
{
// User::unguard();
$settings = new \stdClass;
$settings = new \stdClass();
$settings->invoice = 'ninja';
$company_user = CompanyUser::whereUserId($this->user->id)->whereCompanyId($this->company->id)->first();

View File

@ -280,7 +280,7 @@ trait MockAccountData
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;
@ -414,7 +414,7 @@ trait MockAccountData
'company_id' => $this->company->id,
]);
$gs = new GroupSetting;
$gs = new GroupSetting();
$gs->name = 'Test';
$gs->company_id = $this->client->company_id;
$gs->settings = ClientSettings::buildClientSettings($this->company->settings, $this->client->settings);
@ -772,7 +772,7 @@ trait MockAccountData
$recurring_invoice->number = $this->getNextRecurringInvoiceNumber($this->invoice->client, $this->invoice);
$recurring_invoice->save();
$gs = new GroupSetting;
$gs = new GroupSetting();
$gs->company_id = $this->company->id;
$gs->user_id = $user_id;
$gs->settings = ClientSettings::buildClientSettings(CompanySettings::defaults(), ClientSettings::defaults());
@ -794,7 +794,7 @@ trait MockAccountData
$data[1]['fee_cap'] = '';
$data[1]['is_enabled'] = true;
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $user_id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -807,7 +807,7 @@ trait MockAccountData
$cg->save();
$cg = new CompanyGateway;
$cg = new CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $user_id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';

View File

@ -81,7 +81,7 @@ trait MockUnitData
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;

View File

@ -31,7 +31,6 @@ use Tests\TestCase;
*/
class PdfmockTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();

View File

@ -29,7 +29,7 @@ class BaseSettingsTest extends TestCase
public function testPropertyNamesExist()
{
$blank_object = new \stdClass;
$blank_object = new \stdClass();
$updated_object = $this->migrate($blank_object);
@ -38,7 +38,7 @@ class BaseSettingsTest extends TestCase
public function testPropertyNamesNotExist()
{
$blank_object = new \stdClass;
$blank_object = new \stdClass();
$updated_object = $this->migrate($blank_object);

View File

@ -91,7 +91,7 @@ class CheckDataTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $this->account->id;

View File

@ -19,7 +19,6 @@ use Tests\TestCase;
*/
class DomainCheckTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();

View File

@ -60,7 +60,7 @@ class GeneratesCounterTest extends TestCase
$date_formatted = now($timezone->name)->format('Ymd');
$gs = new GroupSetting;
$gs = new GroupSetting();
$gs->name = 'Test';
$gs->company_id = $this->client->company_id;
$gs->settings = ClientSettings::buildClientSettings($this->company->settings, $this->client->settings);

View File

@ -18,7 +18,7 @@ class ClientTransformerTest extends TestCase
$this->markTestSkipped("NO BUENO");
$company = (new \App\Factory\CompanyFactory)->create(1234);
$company = (new \App\Factory\CompanyFactory())->create(1234);
// Read the JSON string from a file and decode into an associative array
$this->customer_data = json_decode(file_get_contents(app_path('/../tests/Mock/Quickbooks/Data/customer.json')), true);

View File

@ -18,7 +18,7 @@ class ProductTransformerTest extends TestCase
$this->markTestSkipped("NO BUENO");
// Mock the company object
$company = (new \App\Factory\CompanyFactory)->create(1234);
$company = (new \App\Factory\CompanyFactory())->create(1234);
// Read the JSON string from a file and decode into an associative array
$this->product_data = json_decode(file_get_contents(app_path('/../tests/Mock/Quickbooks/Data/item.json')), true);

View File

@ -40,7 +40,7 @@ class InvoiceItemInclusiveTest extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -62,7 +62,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -82,7 +82,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -101,7 +101,7 @@ class InvoiceItemInclusiveTest extends TestCase
$item->discount = 0;
$item->tax_rate1 = 10;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -123,7 +123,7 @@ class InvoiceItemInclusiveTest extends TestCase
$item->discount = 2;
$item->tax_rate1 = 10;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -148,7 +148,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -171,7 +171,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -194,7 +194,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -218,7 +218,7 @@ class InvoiceItemInclusiveTest extends TestCase
$this->invoice->line_items = [$item];
$this->invoice->is_amount_discount = false;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;

View File

@ -52,7 +52,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->tax_rate1 = 22;
@ -82,7 +82,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -111,7 +111,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = -1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -139,7 +139,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -168,7 +168,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = -1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -196,7 +196,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -224,7 +224,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->is_amount_discount = false;
@ -254,7 +254,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = -1;
$line_item->cost = 100;
$line_item->is_amount_discount = false;
@ -285,7 +285,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = -1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -316,7 +316,7 @@ class InvoiceItemTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 100;
$line_item->tax_rate1 = 10;
@ -344,7 +344,7 @@ class InvoiceItemTest extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -364,7 +364,7 @@ class InvoiceItemTest extends TestCase
$item->is_amount_discount = true;
$item->tax_rate1 = 10;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -387,7 +387,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -408,7 +408,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -429,7 +429,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -448,7 +448,7 @@ class InvoiceItemTest extends TestCase
$item->discount = 2;
$item->tax_rate1 = 10;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -471,7 +471,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -493,7 +493,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -517,7 +517,7 @@ class InvoiceItemTest extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;

View File

@ -40,7 +40,7 @@ class InvoiceItemV2Test extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -67,7 +67,7 @@ class InvoiceItemV2Test extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -116,7 +116,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = $line_items;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
$item_calc = new InvoiceItemSum($this->invoice, $settings);
@ -141,7 +141,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
$item_calc = new InvoiceItemSum($this->invoice, $settings);
@ -166,7 +166,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -190,7 +190,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -213,7 +213,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -235,7 +235,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -259,7 +259,7 @@ class InvoiceItemV2Test extends TestCase
$this->invoice->line_items = [$item];
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = false;
$settings->precision = 2;
@ -277,7 +277,7 @@ class InvoiceItemV2Test extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -300,7 +300,7 @@ class InvoiceItemV2Test extends TestCase
$item->cost = 10;
$item->is_amount_discount = true;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -330,7 +330,7 @@ class InvoiceItemV2Test extends TestCase
$item->is_amount_discount = true;
$line_items[] = $item;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;
@ -363,7 +363,7 @@ class InvoiceItemV2Test extends TestCase
$item->is_amount_discount = true;
$line_items[] = $item;
$settings = new \stdClass;
$settings = new \stdClass();
$settings->inclusive_taxes = true;
$settings->precision = 2;

View File

@ -341,7 +341,7 @@ class InvoiceTest extends TestCase
$invoice->status_id = 2;
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 8000;
$line_item->tax_rate1 = 5;
@ -351,7 +351,7 @@ class InvoiceTest extends TestCase
$line_item->tax_id = 1;
$line_items[] = $line_item;
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 9500;
$line_item->tax_rate1 = 5;
@ -391,7 +391,7 @@ class InvoiceTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 25;
$line_item->cost = 0.333;
$line_item->tax_rate1 = 0;
@ -400,7 +400,7 @@ class InvoiceTest extends TestCase
$line_item->notes = 'Test';
$line_items[] = $line_item;
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 25;
$line_item->cost = 0.333;
$line_item->tax_rate1 = 0;
@ -409,7 +409,7 @@ class InvoiceTest extends TestCase
$line_item->notes = 'Test';
$line_items[] = $line_item;
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 25;
$line_item->cost = 1.333;
$line_item->tax_rate1 = 0;
@ -418,7 +418,7 @@ class InvoiceTest extends TestCase
$line_item->notes = 'Test';
$line_items[] = $line_item;
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 25;
$line_item->cost = 0.267;
$line_item->tax_rate1 = 0;
@ -427,7 +427,7 @@ class InvoiceTest extends TestCase
$line_item->notes = 'Test';
$line_items[] = $line_item;
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 25;
$line_item->cost = 0.05;
$line_item->tax_rate1 = 0;
@ -453,7 +453,7 @@ class InvoiceTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 82.6446;
$line_item->tax_rate1 = 21;

View File

@ -81,7 +81,7 @@ class LateFeeTest extends TestCase
$this->company->settings = $settings;
$this->company->save();
$settings = new \stdClass;
$settings = new \stdClass();
$settings->currency_id = '1';
$client = Client::factory()->create([
@ -96,7 +96,7 @@ class LateFeeTest extends TestCase
public function testAddLateFeeAppropriately()
{
$invoice_item = new InvoiceItem;
$invoice_item = new InvoiceItem();
$invoice_item->type_id = '5';
$invoice_item->product_key = trans('texts.fee');
$invoice_item->notes = ctrans('texts.late_fee_added', ['date' => 'xyz']);
@ -154,7 +154,7 @@ class LateFeeTest extends TestCase
$line_items = $invoice->line_items;
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->type_id = '3';
$item->product_key = trans('texts.fee');
$item->quantity = 1;
@ -162,7 +162,7 @@ class LateFeeTest extends TestCase
$line_items[] = $item;
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->type_id = '5';
$item->product_key = trans('texts.fee');
$item->quantity = 1;
@ -236,7 +236,7 @@ class LateFeeTest extends TestCase
$line_items[] = $item;
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->type_id = '5';
$item->product_key = trans('texts.fee');
$item->quantity = 1;
@ -286,7 +286,7 @@ class LateFeeTest extends TestCase
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$cg = new \App\Models\CompanyGateway;
$cg = new \App\Models\CompanyGateway();
$cg->company_id = $this->company->id;
$cg->user_id = $this->user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -329,7 +329,7 @@ class LateFeeTest extends TestCase
$line_items[] = $item;
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->type_id = '5';
$item->product_key = trans('texts.fee');
$item->quantity = 1;
@ -379,7 +379,7 @@ class LateFeeTest extends TestCase
$line_items = $i->line_items;
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->type_id = '5';
$item->product_key = trans('texts.fee');
$item->quantity = 1;
@ -545,7 +545,7 @@ class LateFeeTest extends TestCase
$fee += round($invoice->balance * $percent / 100, 2);
}
$invoice_item = new InvoiceItem;
$invoice_item = new InvoiceItem();
$invoice_item->type_id = '5';
$invoice_item->product_key = trans('texts.fee');
$invoice_item->notes = ctrans('texts.late_fee_added', ['date' => now()]);

View File

@ -50,7 +50,7 @@ class FeesAndLimitsTest extends TestCase
$new_arr = [];
foreach ($fees_and_limits as $key => $value) {
$fal = new FeesAndLimits;
$fal = new FeesAndLimits();
// $fal->{$key} = $value;
foreach ($value as $k => $v) {

View File

@ -20,7 +20,6 @@ use Tests\TestCase;
*/
class NumberTest extends TestCase
{
public function testRangeOfNumberFormats()
{

View File

@ -21,7 +21,6 @@ use Tests\TestCase;
*/
class PaymentTypeTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
@ -30,7 +29,7 @@ class PaymentTypeTest extends TestCase
public function testTranslationsExist()
{
$payment_type_class = new PaymentType;
$payment_type_class = new PaymentType();
foreach($payment_type_class->type_names as $type) {
$this->assertTrue(Lang::has("texts.{$type}"));

View File

@ -70,7 +70,7 @@ class PermissionsTest extends TestCase
$this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken;
$company_token = new CompanyToken();
$company_token->user_id = $this->user->id;
$company_token->company_id = $this->company->id;
$company_token->account_id = $account->id;

View File

@ -58,7 +58,7 @@ class RelationExistsTest extends TestCase
public function testAssignedUserRelationExists()
{
foreach ($this->models as $model) {
$class = new $model;
$class = new $model();
$this->assertTrue(method_exists($class, 'assigned_user'));
}

View File

@ -1,5 +1,7 @@
<?php
// tests/Unit/IntuitSDKWrapperTest.php
namespace Tests\Unit\Services\Import\Quickbooks;
use Mockery;
@ -10,7 +12,6 @@ use App\Services\Import\Quickbooks\SdkWrapper as QuickbookSDK;
class SdkWrapperTest extends TestCase
{
protected $sdk;
protected $sdkMock;
@ -27,13 +28,16 @@ class SdkWrapperTest extends TestCase
$this->markTestSkipped('no resource');
}
function testIsInstanceOf() {
public function testIsInstanceOf()
{
$this->assertInstanceOf(SdkInterface::class, $this->sdk);
}
function testMethodFetchRecords() {
public function testMethodFetchRecords()
{
$data = json_decode(
file_get_contents(base_path('tests/Mock/Quickbooks/Data/customers.json')),true
file_get_contents(base_path('tests/Mock/Quickbooks/Data/customers.json')),
true
);
$count = count($data);
$this->sdkMock->shouldReceive('Query')->andReturnUsing(function ($val) use ($count, $data) {

View File

@ -1,4 +1,5 @@
<?php
namespace Tests\Unit\Services\Import\Quickbooks;
use Mockery;

View File

@ -56,7 +56,7 @@ class ShopProfileTest extends TestCase
$settings = $this->company->settings;
$trans = new \stdClass;
$trans = new \stdClass();
$trans->product = "Service";
$trans->products = "Services";

View File

@ -89,13 +89,13 @@ class SubscriptionsCalcTest extends TestCase
$this->assertEquals(10, $invoice->amount);
$this->assertEquals(0, $invoice->balance);
$pro_rata = new ProRata;
$pro_rata = new ProRata();
$refund = $pro_rata->refund($invoice->amount, Carbon::parse('2021-01-01'), Carbon::parse('2021-01-06'), $subscription->frequency_id);
// $this->assertEquals(1.61, $refund);
$pro_rata = new ProRata;
$pro_rata = new ProRata();
$upgrade = $pro_rata->charge($target->price, Carbon::parse('2021-01-01'), Carbon::parse('2021-01-06'), $subscription->frequency_id);

View File

@ -26,15 +26,14 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
*/
class TaskRoundingTest extends TestCase
{
use MakesHash;
use DatabaseTransactions;
use MockAccountData;
public int $task_round_to_nearest = 1;
public bool $task_round_up = true;
use MakesHash;
use DatabaseTransactions;
use MockAccountData;
private $faker;
protected function setUp(): void
@ -222,16 +221,19 @@ $this->assertEquals($rounded, $this->roundTimeLog($start_time, $end_time));
public function roundTimeLog(int $start_time, int $end_time): int
{
if($this->task_round_to_nearest == 1 || $end_time == 0)
if($this->task_round_to_nearest == 1 || $end_time == 0) {
return $end_time;
}
$interval = $end_time - $start_time;
if($this->task_round_up)
if($this->task_round_up) {
return $start_time + (int)ceil($interval / $this->task_round_to_nearest) * $this->task_round_to_nearest;
}
if($interval <= $this->task_round_to_nearest)
if($interval <= $this->task_round_to_nearest) {
return $start_time;
}
return $start_time + (int)floor($interval / $this->task_round_to_nearest) * $this->task_round_to_nearest;

View File

@ -184,7 +184,7 @@ class SumTaxTest extends TestCase
$line_items = [];
$line_item = new InvoiceItem;
$line_item = new InvoiceItem();
$line_item->quantity = 1;
$line_item->cost = 10;
$line_item->product_key = 'Test';

View File

@ -18,7 +18,6 @@ use Tests\TestCase;
*/
class TimeZoneTest extends TestCase
{
private array $timezones = [
'Pacific/Midway' => 'Pacific/Midway',
'US/Samoa' => 'Pacific/Pago_Pago',
@ -146,8 +145,7 @@ private array $timezones = [
{
foreach($this->timezones as $timezone)
{
foreach($this->timezones as $timezone) {
date_default_timezone_set('GMT');
$date = new \DateTime("now", new \DateTimeZone($timezone));

View File

@ -29,7 +29,7 @@ class BlacklistValidationTest extends TestCase
public function testValidEmailRule3()
{
$rules = [
'email' => [new EmailBlackListRule],
'email' => [new EmailBlackListRule()],
];
$data = [
@ -44,7 +44,7 @@ class BlacklistValidationTest extends TestCase
public function testValidEmailRule2()
{
$rules = [
'email' => [new EmailBlackListRule],
'email' => [new EmailBlackListRule()],
];
$data = [
@ -58,7 +58,7 @@ class BlacklistValidationTest extends TestCase
public function testValidEmailRule()
{
$rules = [
'email' => [new BlackListRule],
'email' => [new BlackListRule()],
];
$data = [
@ -72,7 +72,7 @@ class BlacklistValidationTest extends TestCase
public function testInValidEmailRule()
{
$rules = [
'email' => [new BlackListRule],
'email' => [new BlackListRule()],
];
$data = [
@ -86,7 +86,7 @@ class BlacklistValidationTest extends TestCase
public function testInValidEmailRule2()
{
$rules = [
'email' => [new BlackListRule],
'email' => [new BlackListRule()],
];
$data = [
@ -100,7 +100,7 @@ class BlacklistValidationTest extends TestCase
public function testInValidEmailRule3()
{
$rules = [
'email' => [new BlackListRule],
'email' => [new BlackListRule()],
];
$data = [

View File

@ -27,7 +27,7 @@ class EmailBlacklistValidationTest extends TestCase
public function testValidEmailRule()
{
$email_rule = new EmailBlackListRule;
$email_rule = new EmailBlackListRule();
$email_rule->blacklist = ['gimmy@gmail.com'];
$rules = [
@ -45,7 +45,7 @@ class EmailBlacklistValidationTest extends TestCase
public function testInValidEmailRule()
{
$rules = [
'email' => [new EmailBlackListRule],
'email' => [new EmailBlackListRule()],
];
$data = [

View File

@ -20,7 +20,6 @@ use Tests\TestCase;
class WithTypeHelpersTest extends TestCase
{
public function testIsImageHelper(): void
{
$account = Account::factory()->create();