php-cs-fix for tests

This commit is contained in:
David Bomba
2025-10-29 11:13:52 +11:00
parent 6f1ebf57a9
commit b08c575b35
266 changed files with 2211 additions and 1997 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -17,7 +18,6 @@ use Illuminate\Validation\ValidationException;
use Tests\MockAccountData;
use Tests\TestCase;
class ActivityApiTest extends TestCase
{
use DatabaseTransactions;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -55,7 +55,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -115,7 +115,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -175,7 +175,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -236,7 +236,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -295,7 +295,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -352,7 +352,7 @@ class BankTransactionRuleTest extends TestCase
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -392,7 +392,7 @@ class BankTransactionRuleTest extends TestCase
(new ProcessBankRules($bt))->run();
$bt = $bt->fresh();
$bt = $bt->fresh();
$this->assertEquals(BankTransaction::STATUS_MATCHED, $bt->status_id);
$this->assertNotNull($p->id);
@@ -410,7 +410,7 @@ $bt = $bt->fresh();
]);
$hash = md5(time());
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -450,7 +450,7 @@ $bt = $bt->fresh();
(new ProcessBankRules($bt))->run();
$bt = $bt->fresh();
$bt = $bt->fresh();
$this->assertEquals(BankTransaction::STATUS_MATCHED, $bt->status_id);
$this->assertNotNull($p->id);
@@ -468,7 +468,7 @@ $bt = $bt->fresh();
]);
$hash = md5(time());
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -508,7 +508,7 @@ $bt = $bt->fresh();
(new ProcessBankRules($bt))->run();
$bt = $bt->fresh();
$bt = $bt->fresh();
$this->assertEquals(BankTransaction::STATUS_MATCHED, $bt->status_id);
$this->assertNotNull($p->id);
@@ -526,7 +526,7 @@ $bt = $bt->fresh();
]);
$hash = Str::random(32);
$rand_amount = rand(1000,10000000);
$rand_amount = rand(1000, 10000000);
$bt = BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
@@ -566,7 +566,7 @@ $bt = $bt->fresh();
(new ProcessBankRules($bt))->run();
$bt = $bt->fresh();
$bt = $bt->fresh();
$this->assertEquals(BankTransaction::STATUS_MATCHED, $bt->status_id);
$this->assertNotNull($p->id);

View File

@@ -43,7 +43,7 @@ class BankTransactionTest extends TestCase
public function testBankIntegrationFilters()
{
BankTransaction::where('company_id', $this->company->id)
->cursor()->each(function($bt){
->cursor()->each(function ($bt) {
$bt->forceDelete();
});

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -18,7 +19,6 @@ use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
class BankIntegrationApiTest extends TestCase
{
use MakesHash;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -21,7 +22,6 @@ use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
class BankTransactionApiTest extends TestCase
{
use MakesHash;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -18,7 +19,6 @@ use Illuminate\Support\Facades\Session;
use Tests\MockAccountData;
use Tests\TestCase;
class BankTransactionRuleApiTest extends TestCase
{
use MakesHash;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -19,7 +20,6 @@ use Illuminate\Routing\Middleware\ThrottleRequests;
use Tests\MockAccountData;
use Tests\TestCase;
class CancelInvoiceTest extends TestCase
{
use MakesHash;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -20,7 +21,6 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ClientGatewayTokenApiTest extends TestCase
{
use MakesHash;
@@ -198,14 +198,12 @@ class ClientGatewayTokenApiTest extends TestCase
$arr = $response->json();
$this->assertCount(2,$arr['data']['gateway_tokens']);
$this->assertCount(2, $arr['data']['gateway_tokens']);
foreach($arr['data']['gateway_tokens'] as $token)
{
if($token['id'] == $t1){
foreach ($arr['data']['gateway_tokens'] as $token) {
if ($token['id'] == $t1) {
$this->assertTrue($token['is_default']);
}
else {
} else {
$this->assertFalse($token['is_default']);
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -37,7 +38,7 @@ 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

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -169,7 +170,7 @@ class ClientTest extends TestCase
$this->assertEquals($gs->id, $c->group_settings_id);
});
foreach($arr['data'] as $client_response) {
foreach ($arr['data'] as $client_response) {
$this->assertEquals($gs->hashed_id, $client_response['group_settings_id']);
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -509,8 +510,8 @@ class CreditTest extends TestCase
$ii->notes = 'yy';
$credit_array['line_items'] = [];
$credit_array['line_items'][] = (array)$ii;
$credit_array['line_items'] = [];
$credit_array['line_items'][] = (array)$ii;
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -86,7 +87,7 @@ class DesignApiTest extends TestCase
$response->assertStatus(200);
$new_design_truth_test = Invoice::where('company_id', $this->company->id)->orderBy('id','asc')->where('design_id', 7)->exists();
$new_design_truth_test = Invoice::where('company_id', $this->company->id)->orderBy('id', 'asc')->where('design_id', 7)->exists();
$this->assertTrue($new_design_truth_test);
@@ -195,7 +196,7 @@ class DesignApiTest extends TestCase
$response->assertStatus(200);
$new_design_truth_test = Quote::where('company_id', $this->company->id)->orderBy('id','asc')->where('design_id', 7)->exists();
$new_design_truth_test = Quote::where('company_id', $this->company->id)->orderBy('id', 'asc')->where('design_id', 7)->exists();
$this->assertTrue($new_design_truth_test);
@@ -304,7 +305,7 @@ class DesignApiTest extends TestCase
$response->assertStatus(200);
$new_design_truth_test = Credit::where('company_id', $this->company->id)->orderBy('id','asc')->where('design_id', 7)->exists();
$new_design_truth_test = Credit::where('company_id', $this->company->id)->orderBy('id', 'asc')->where('design_id', 7)->exists();
$this->assertTrue($new_design_truth_test);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -28,7 +29,7 @@ class EInvoiceApiTest extends TestCase
{
parent::setUp();
if(!config('ninja.storecove_api_key')) {
if (!config('ninja.storecove_api_key')) {
$this->markTestSkipped('Storecove API key not set');
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -131,7 +132,7 @@ class FatturaPATest extends TestCase
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -134,7 +135,7 @@ class PeppolTest extends TestCase
/** @var ClientContact $contact */
$contact = ClientContact::factory()->create([
'client_id' => $client->id,
'company_id' =>$client->company_id,
'company_id' => $client->company_id,
'user_id' => $client->user_id,
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
@@ -165,8 +166,7 @@ class PeppolTest extends TestCase
$items = $invoice->line_items;
foreach($items as &$item)
{
foreach ($items as &$item) {
$item->tax_name2 = '';
$item->tax_rate2 = 0;
$item->tax_name3 = '';
@@ -300,7 +300,7 @@ class PeppolTest extends TestCase
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/einvoice/validateEntity', $data);
if($response->getStatusCode() !== 200){
if ($response->getStatusCode() !== 200) {
$p = new Peppol($invoice);
nlog($p->run()->toXml());
@@ -503,7 +503,7 @@ class PeppolTest extends TestCase
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/einvoice/validateEntity', $data);
if($response->getStatusCode() !== 422){
if ($response->getStatusCode() !== 422) {
$p = new Peppol($invoice);
nlog($p->run()->toXml());
@@ -571,7 +571,7 @@ class PeppolTest extends TestCase
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/einvoice/validateEntity', $data);
if($response->getStatusCode() !== 200){
if ($response->getStatusCode() !== 200) {
$p = new Peppol($invoice);
nlog($p->run()->toXml());
@@ -661,8 +661,7 @@ class PeppolTest extends TestCase
],
];
foreach($scenarios as $scenario)
{
foreach ($scenarios as $scenario) {
$data = $this->setupTestData($scenario);
$invoice = $data['invoice'];
@@ -705,7 +704,7 @@ class PeppolTest extends TestCase
$this->assertCount(0, $validator->getErrors());
}
for($x=0; $x< $this->iterations; $x++){
for ($x = 0; $x < $this->iterations; $x++) {
$scenario = $scenarios[0];
@@ -927,7 +926,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -1072,7 +1071,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -1202,7 +1201,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -1337,7 +1336,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -1346,17 +1345,16 @@ class PeppolTest extends TestCase
$xml = $peppol->toXml();
try{
try {
$processor = new \Saxon\SaxonProcessor();
}
catch(\Throwable $e){
} catch (\Throwable $e) {
$this->markTestSkipped('saxon not installed');
}
$validator = new XsltDocumentValidator($xml);
$validator->validate();
if(count($validator->getErrors()) >0){
if (count($validator->getErrors()) > 0) {
nlog($xml);
nlog($validator->getErrors());
}
@@ -1493,7 +1491,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -1502,17 +1500,16 @@ class PeppolTest extends TestCase
$xml = $peppol->toXml();
try{
try {
$processor = new \Saxon\SaxonProcessor();
}
catch(\Throwable $e){
} catch (\Throwable $e) {
$this->markTestSkipped('saxon not installed');
}
$validator = new XsltDocumentValidator($xml);
$validator->validate();
if(count($validator->getErrors()) >0){
if (count($validator->getErrors()) > 0) {
nlog($xml);
nlog($validator->getErrors());
}
@@ -1645,7 +1642,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -1655,18 +1652,16 @@ class PeppolTest extends TestCase
try{
try {
$processor = new \Saxon\SaxonProcessor();
}
catch(\Throwable $e){
} catch (\Throwable $e) {
$this->markTestSkipped('saxon not installed');
}
$validator = new XsltDocumentValidator($xml);
$validator->validate();
if(count($validator->getErrors()) > 0)
{
if (count($validator->getErrors()) > 0) {
nlog($xml);
nlog($validator->getErrors());
}
@@ -1798,7 +1793,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -1808,18 +1803,16 @@ class PeppolTest extends TestCase
try{
try {
$processor = new \Saxon\SaxonProcessor();
}
catch(\Throwable $e){
} catch (\Throwable $e) {
$this->markTestSkipped('saxon not installed');
}
$validator = new XsltDocumentValidator($xml);
$validator->validate();
if(count($validator->getErrors()) > 0)
{
if (count($validator->getErrors()) > 0) {
nlog($xml);
nlog($validator->getErrors());
}
@@ -1945,7 +1938,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -2069,7 +2062,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($de_invoice);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}
@@ -2178,7 +2171,7 @@ class PeppolTest extends TestCase
$errors = $e->validate($fe);
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($errors);
}

View File

@@ -71,8 +71,9 @@ class RemoveTaxIdentifierRequestTest extends TestCase
$validator = Validator::make($data, $this->request->rules());
if(!$validator->passes())
if (!$validator->passes()) {
nlog($validator->errors());
}
$this->assertFalse($validator->passes());
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -1113,7 +1114,8 @@ class VerifactuApiTest extends TestCase
public function test_create_modification_invoice_validation_fails()
{
$invoice = $this->buildData();;
$invoice = $this->buildData();
;
$data = $invoice->toArray();
$data['verifactu_modified'] = true;
@@ -1129,7 +1131,8 @@ class VerifactuApiTest extends TestCase
public function test_create_modification_invoice_validation_fails2()
{
$invoice = $this->buildData();;
$invoice = $this->buildData();
;
$data = $invoice->toArray();
$data['verifactu_modified'] = true;
@@ -1146,7 +1149,8 @@ class VerifactuApiTest extends TestCase
public function test_create_modification_invoice_validation_fails3()
{
$invoice = $this->buildData();;
$invoice = $this->buildData();
;
$invoice2 = $this->buildData();
$invoice2->service()->markPaid()->save();
@@ -1173,7 +1177,8 @@ class VerifactuApiTest extends TestCase
$this->company->settings = $settings;
$this->company->save();
$invoice = $this->buildData();;
$invoice = $this->buildData();
;
$invoice2 = $this->buildData();
$invoice2->service()->markSent()->save();

View File

@@ -88,7 +88,7 @@ class VerifactuFeatureTest extends TestCase
$this->user = $u;
if(!$settings) {
if (!$settings) {
$settings = CompanySettings::defaults();
$settings->client_online_payment_notification = false;
$settings->client_manual_payment_notification = false;
@@ -174,7 +174,7 @@ class VerifactuFeatureTest extends TestCase
$item->notes = 'Test item';
$item->tax_name1 = 'IVA';
$item->tax_rate1 = 21;
$item->discount =0;
$item->discount = 0;
$line_items[] = $item;
@@ -219,9 +219,9 @@ class VerifactuFeatureTest extends TestCase
*/
public function test_construction_and_validation()
{
// - current previous hash - 10C643EDC7DC727FAC6BAEBAAC7BEA67B5C1369A5A5ED74E5AD3149FC30A3C8C
//BE95547AA8B973A3D6A860B36833FBDE3C8AB853F4B8F05872574A5DA7314A23
// - current previous invoice number - TEST0033343443
// - current previous hash - 10C643EDC7DC727FAC6BAEBAAC7BEA67B5C1369A5A5ED74E5AD3149FC30A3C8C
//BE95547AA8B973A3D6A860B36833FBDE3C8AB853F4B8F05872574A5DA7314A23
// - current previous invoice number - TEST0033343443
$invoice = $this->buildData();
@@ -393,7 +393,7 @@ class VerifactuFeatureTest extends TestCase
$items = $invoice->line_items;
foreach($items as &$item) {
foreach ($items as &$item) {
$item->quantity = -1;
}
@@ -480,7 +480,7 @@ class VerifactuFeatureTest extends TestCase
$invoice2->backup->document_type = 'R2';
$items = $invoice2->line_items;
foreach($items as &$item) {
foreach ($items as &$item) {
$item->quantity = -1;
}
@@ -512,7 +512,7 @@ class VerifactuFeatureTest extends TestCase
$this->assertArrayHasKey('success', $response);
$this->assertTrue($response['success']);
//Lets try and cancel the credit note now - we should fail!!
//Lets try and cancel the credit note now - we should fail!!
$verifactu = new Verifactu($invoice2);
$document = (new RegistroAlta($invoice2))->run()->getInvoice();
$huella = $this->cancellationHash($document, $document2->getHuella());
@@ -628,7 +628,7 @@ class VerifactuFeatureTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog('Errors:');
nlog($errors);
nlog('Errors:');
@@ -834,7 +834,7 @@ class VerifactuFeatureTest extends TestCase
}
////////////////////////////////////////////////
////////////////////////////////////////////////
private function cancellationHash($document, $huella)
{
@@ -868,7 +868,7 @@ class VerifactuFeatureTest extends TestCase
}
//@todo - need to confirm that building the xml and sending works.
//@todo - need to confirm that building the xml and sending works.
public function test_verifactu_invoice_model_can_build_xml()
{
@@ -911,16 +911,16 @@ class VerifactuFeatureTest extends TestCase
$invoice->setDesglose($desglose);
$destinatarios = [];
$destinatario = new PersonaFisicaJuridica();
$destinatarios = [];
$destinatario = new PersonaFisicaJuridica();
$destinatario
$destinatario
->setNif('A39200020')
->setNombreRazon('Empresa Ejemplo SL VV');
$destinatarios[] = $destinatario;
$destinatarios[] = $destinatario;
$invoice->setDestinatarios($destinatarios);
$invoice->setDestinatarios($destinatarios);
// Add information system
$sistema = new SistemaInformatico();

View File

@@ -26,7 +26,6 @@ use App\Services\EDocument\Standards\Verifactu\Models\IDOtro;
class VerifactuModelTest extends TestCase
{
public function test_and_create_new_invoice_for_non_spanish_client(): void
{
@@ -104,7 +103,7 @@ class VerifactuModelTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -197,7 +196,7 @@ class VerifactuModelTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -538,7 +537,7 @@ class VerifactuModelTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -625,7 +624,7 @@ class VerifactuModelTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}
@@ -701,7 +700,7 @@ class VerifactuModelTest extends TestCase
$xslt->validate();
$errors = $xslt->getVerifactuErrors();
if(count($errors) > 0) {
if (count($errors) > 0) {
nlog($xml);
nlog($errors);
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -78,7 +79,7 @@ class ExpenseApiTest extends TestCase
$response->assertStatus(200);
$expenses->cursor()->each(function ($e){
$expenses->cursor()->each(function ($e) {
$this->assertEquals('GST', $e->tax_name1);
$this->assertEquals(10, $e->tax_rate1);
});

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -143,7 +143,7 @@ class EInvoiceReportTest extends TestCase
'user_id' => $this->user->id,
];
$guid = new \stdClass;
$guid = new \stdClass();
$guid->guid = '1234567890';
$i = Invoice::factory()->create([

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -192,8 +193,9 @@ class ReportCsvGenerationTest extends TestCase
*/
private function buildData()
{
if($this->account)
if ($this->account) {
$this->account->forceDelete();
}
/** @var \App\Models\Account $account */
$this->account = Account::factory()->create([
@@ -322,7 +324,7 @@ class ReportCsvGenerationTest extends TestCase
$this->assertEquals('client.name', $array[2]); //@phpstan-ignore-line
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -345,7 +347,7 @@ $this->account->forceDelete();
$products = explode(",", "clown,joker,batman,bob the builder");
foreach($products as $product) {
foreach ($products as $product) {
$query->where(function ($q) use ($product) {
$q->orWhereJsonContains('line_items', ['product_key' => $product]);
});
@@ -369,7 +371,7 @@ $this->account->forceDelete();
);
$query->where(function ($q) use ($products) {
foreach($products as $product) {
foreach ($products as $product) {
$q->orWhereJsonContains('line_items', ['product_key' => $product]);
}
});
@@ -399,7 +401,7 @@ $this->account->forceDelete();
$query = Invoice::query();
$query->where(function ($q) use ($products) {
foreach($products as $product) {
foreach ($products as $product) {
$q->orWhereJsonContains('line_items', ['product_key' => $product]);
}
});
@@ -415,7 +417,7 @@ $this->account->forceDelete();
$this->assertEquals(1, $query->count());
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -476,7 +478,7 @@ $this->account->forceDelete();
$this->assertEquals(1, $q->count());
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -558,7 +560,7 @@ $this->account->forceDelete();
$this->assertEquals('address1', $this->traverseJson($data, '0.0.display_value'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -630,7 +632,7 @@ $this->account->forceDelete();
$this->assertEquals('Vendor 1', $this->traverseJson($data, '0.0.display_value'));
$this->assertEquals('number', $this->traverseJson($data, '0.2.id'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -785,7 +787,7 @@ $this->account->forceDelete();
$csv = $response->body();
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -841,7 +843,7 @@ $this->account->forceDelete();
$this->assertEquals('Custom 3', $this->getFirstValueByColumn($csv, 'Task Custom Value 3'));
$this->assertEquals('Custom 4', $this->getFirstValueByColumn($csv, 'Task Custom Value 4'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -908,7 +910,7 @@ $this->account->forceDelete();
$this->assertEquals('custom_value1', $this->traverseJson($data, '0.0.identifier'));
$this->assertEquals('Custom 1', $this->traverseJson($data, '0.0.display_value'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -951,8 +953,8 @@ $this->account->forceDelete();
$invoice->push();
$repo = new InvoiceRepository();
$invoice = $repo->save([], $invoice);
$repo = new InvoiceRepository();
$invoice = $repo->save([], $invoice);
$invoice->service()->markPaid()->save();
@@ -1057,7 +1059,7 @@ $invoice = $repo->save([], $invoice);
$csv = $response->body();
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1103,7 +1105,7 @@ $this->account->forceDelete();
$this->assertEquals('2020-01-01', $this->getFirstValueByColumn($csv, 'Payment Date'));
$this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Payment Transaction Reference'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1145,7 +1147,7 @@ $this->account->forceDelete();
$this->assertEquals('bob', $res[1]);
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1286,7 +1288,7 @@ $this->account->forceDelete();
$response = $this->poll($hash);
$csv = $response->body();
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1370,7 +1372,7 @@ $this->account->forceDelete();
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/invoices', $data)->assertStatus(200);
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1426,7 +1428,7 @@ $this->account->forceDelete();
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/recurring_invoices', $data)->assertStatus(200);
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1475,7 +1477,7 @@ $this->account->forceDelete();
$this->assertEquals('Daily', $this->getFirstValueByColumn($csv, 'Recurring Invoice How Often'));
$this->assertEquals('Active', $this->getFirstValueByColumn($csv, 'Recurring Invoice Status'));
$this->account->forceDelete();
$this->account->forceDelete();
}
@@ -1516,8 +1518,8 @@ $this->account->forceDelete();
]
]);
$repo = new InvoiceRepository();
$invoice = $repo->save([], $invoice);
$repo = new InvoiceRepository();
$invoice = $repo->save([], $invoice);
$data = [
'date_range' => 'all',
@@ -1588,7 +1590,7 @@ $invoice = $repo->save([], $invoice);
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/reports/invoice_items', $data)->assertStatus(200);
$this->account->forceDelete();
$this->account->forceDelete();
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -219,7 +220,7 @@ class TaxSummaryReportTest extends TestCase
$i2 = $i2->calc()->getInvoice();
$i2->service()->markPaid();
for($x=0; $x<50; $x++){
for ($x = 0; $x < 50; $x++) {
$date = now();

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -99,7 +99,7 @@ class ImportQuickbooksControllerTest extends TestCase
$count = count($data);
$this->mock->shouldReceive('Query')->andReturnUsing(
function ($val, $s = 1, $max = 1000) use ($count, $data) {
if(stristr($val, 'count')) {
if (stristr($val, 'count')) {
return $count;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -95,7 +96,7 @@ class TaskImportTest extends TestCase
$time_log = json_decode($task->time_log);
foreach($time_log as $log) {
foreach ($time_log as $log) {
$this->assertTrue($log[3]);
}
@@ -105,7 +106,7 @@ class TaskImportTest extends TestCase
$time_log = json_decode($task->time_log);
foreach($time_log as $log) {
foreach ($time_log as $log) {
$this->assertTrue($log[3]);
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -39,13 +39,13 @@ class QuickbooksExportTest extends TestCase
parent::setUp();
if(config('ninja.testvars.travis') || !config('services.quickbooks.client_id')){
if (config('ninja.testvars.travis') || !config('services.quickbooks.client_id')) {
$this->markTestSkipped('No Quickbooks Client ID found');
}
$company = Company::find(1);
if(!$company){
if (!$company) {
$this->markTestSkipped('No company found');
}
@@ -63,8 +63,7 @@ class QuickbooksExportTest extends TestCase
// 'sales' => 'SalesReceipt',
];
foreach($entities as $key => $entity)
{
foreach ($entities as $key => $entity) {
$records = $this->qb->sdk()->fetchRecords($entity);
$this->assertNotNull($records);

View File

@@ -102,7 +102,7 @@ class QuickbooksMappingTest extends TestCase
// nlog($qb_invoice);
// nlog($invoice->toArray());
if(!$qb_invoice) {
if (!$qb_invoice) {
nlog("Borked trying to find invoice {$invoice->sync->qb_id} in qb_invoices");
}
@@ -116,8 +116,8 @@ class QuickbooksMappingTest extends TestCase
// nlog($total_balance);
// nlog($invoice->balance);
$delta_amount = abs(round($total_amount - $invoice->amount,2));
$delta_balance = abs(round($total_balance - $invoice->balance,2));
$delta_amount = abs(round($total_amount - $invoice->amount, 2));
$delta_balance = abs(round($total_balance - $invoice->balance, 2));
$this->assertLessThanOrEqual(0.01, $delta_amount);
$this->assertLessThanOrEqual(0.01, $delta_balance);

View File

@@ -221,11 +221,11 @@ class QuickbooksTest extends TestCase
$qb_invoice = $this->createQbInvoice($customer);
$this->assertNotNull($qb_invoice);
$this->assertNotNull($qb_invoice);
// sleep(5);
// sleep(5);
// $updatedInvoice = $this->qb->sdk->FindById('invoice', $qb_invoice->Id->value);
// $updatedInvoice = $this->qb->sdk->FindById('invoice', $qb_invoice->Id->value);
@@ -327,8 +327,7 @@ $this->assertNotNull($qb_invoice);
$line_num = 1;
foreach($i->line_items as $line_item)
{
foreach ($i->line_items as $line_item) {
$product = Product::where('company_id', $this->company->id)
->where('product_key', $line_item->product_key)
->first();

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -104,7 +105,7 @@ class OfficeParseTest extends TestCase
}
// Only add rows that have at least one non-empty cell
if (array_filter($rowData, function($value) { return !empty($value); })) {
if (array_filter($rowData, function ($value) { return !empty($value); })) {
$dataRows[] = $rowData;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -57,9 +58,9 @@ class InvoiceEmailTest extends TestCase
$request = new SendEmailRequest();
collect($request->templates)->filter(function ($template){
collect($request->templates)->filter(function ($template) {
return stripos($template, 'quote') === false;
})->each(function ($template) use($request){
})->each(function ($template) use ($request) {
$data = [

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -85,11 +86,10 @@ class InvoiceTaxReportTest extends TestCase
$this->assertNotNull($i);
//test tax data object to see if we are using automated taxes.
if(isset($i->tax_data->geoState)){
if (isset($i->tax_data->geoState)) {
$nexus = $i->tax_data->geoState;
$country_nexus = 'USA';
}
else {
} else {
$nexus = strlen($i->client->state ?? '') > 0 ? $i->client->state : $i->company->settings->state;
$country_nexus = strlen($i->client->state ?? '') > 0 ? $i->client->country->iso_3166_2 : $i->company->country()->iso_3166_2;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -291,7 +292,7 @@ class MultiPaymentDeleteTest extends TestCase
],
'date' => '2019/12/12',
];
sleep(1);
sleep(1);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -96,7 +97,7 @@ class AutoUnappliedPaymentTest extends TestCase
try {
$invoice->service()->autoBill()->save();
} catch(\Exception $e) {
} catch (\Exception $e) {
}
@@ -156,7 +157,7 @@ class AutoUnappliedPaymentTest extends TestCase
try {
$invoice->service()->autoBill()->save();
} catch(\Exception $e) {
} catch (\Exception $e) {
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -189,7 +190,7 @@ class UnappliedPaymentDeleteTest extends TestCase
$payment_hashed_id = $arr['data']['id'];
$payment = Payment::find($this->decodePrimaryKey($payment_hashed_id));
$payment->invoices()->each(function ($i){
$payment->invoices()->each(function ($i) {
$this->assertEquals(20, $i->pivot->amount);
$this->assertEquals(0, $i->pivot->refunded);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -12,7 +13,6 @@
namespace Tests\Feature\PhpOffice;
use Tests\TestCase;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@@ -120,8 +121,8 @@ class ProductTest extends TestCase
foreach ($line_items as $key => $item) {
if($product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first()) {
if((property_exists($item, 'product_cost') && $item->product_cost == 0) || !property_exists($item, 'product_cost')) {
if ($product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first()) {
if ((property_exists($item, 'product_cost') && $item->product_cost == 0) || !property_exists($item, 'product_cost')) {
$line_items[$key]->product_cost = $product->cost;
}
}
@@ -167,7 +168,7 @@ class ProductTest extends TestCase
'X-API-TOKEN' => $this->token,
])->post('/api/v1/products/bulk', $update)
->assertStatus(200);
} catch(\Exception $e) {
} catch (\Exception $e) {
}

Some files were not shown because too many files have changed in this diff Show More