diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index f2eec912ae..e46de074b8 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -970,14 +970,14 @@ class CheckData extends Command public function checkClientSettings() { if ($this->option('fix') == 'true') { - Client::query()->whereNull('country_id')->orWhere('country_id', 0)->cursor()->each(function ($client) { + Client::query()->withTrashed()->whereNull('country_id')->orWhere('country_id', 0)->cursor()->each(function ($client) { $client->country_id = $client->company->settings->country_id; $client->saveQuietly(); $this->logMessage("Fixing country for # {$client->id}"); }); - Client::query()->whereNull("settings->currency_id")->orWhereJsonContains('settings', ['currency_id' => ''])->cursor()->each(function ($client) { + Client::query()->withTrashed()->whereNull("settings->currency_id")->orWhereJsonContains('settings', ['currency_id' => ''])->cursor()->each(function ($client) { $settings = $client->settings; $settings->currency_id = (string)$client->company->settings->currency_id; $client->settings = $settings; @@ -987,7 +987,7 @@ class CheckData extends Command }); - Payment::withTrashed()->where('exchange_rate', 0)->cursor()->each(function ($payment) { + Payment::withTrashed()->withTrashed()->where('exchange_rate', 0)->cursor()->each(function ($payment) { $payment->exchange_rate = 1; $payment->saveQuietly(); @@ -1000,11 +1000,11 @@ class CheckData extends Command }) ->cursor() ->each(function ($p) { - $p->currency_id = $p->client->settings->currency_id; + $p->currency_id = $p->client->settings->currency_id ?? $p->company->settings->currency_id; $p->saveQuietly(); - $this->logMessage("Fixing currency for # {$p->id}"); + $this->logMessage("Fixing currency for # {$p->id} with new currency {$p->currency_id}"); }); @@ -1015,7 +1015,7 @@ class CheckData extends Command $c->subdomain = MultiDB::randomSubdomainGenerator(); $c->save(); - $this->logMessage("Fixing subdomain for # {$c->id}"); + $this->logMessage("Fixing subdomain for # {$c->id} with new subdomain {$c->subdomain}"); }); @@ -1076,7 +1076,7 @@ class CheckData extends Command public function checkVendorSettings() { if ($this->option('fix') == 'true') { - Vendor::query()->whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor) { + Vendor::query()->withTrashed()->whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor) { $vendor->currency_id = $vendor->company->settings->currency_id; $vendor->saveQuietly(); @@ -1174,7 +1174,7 @@ class CheckData extends Command $bt->invoice_ids = collect($bt->payment->invoices)->pluck('hashed_id')->implode(','); $bt->save(); - $this->logMessage("Fixing - {$bt->id}"); + $this->logMessage("Fixing - {$bt->id} with new invoice IDs {$bt->invoice_ids}"); } @@ -1195,7 +1195,7 @@ class CheckData extends Command $c->send_email = false; $c->saveQuietly(); - $this->logMessage("Fixing - {$c->id}"); + $this->logMessage("Fixing - {$c->id} with new send email {$c->send_email}"); }); } @@ -1234,11 +1234,11 @@ class CheckData extends Command if ($this->option('fix') == 'true') { - $p->cursor()->each(function ($c) { - $c->currency_id = $c->client->settings->currency_id ?? $c->company->settings->currency_id; - $c->saveQuietly(); + $p->cursor()->each(function ($payment) { + $payment->currency_id = $payment->client->settings->currency_id ?? $payment->company->settings->currency_id; + $payment->saveQuietly(); - $this->logMessage("Fixing - {$c->id}"); + $this->logMessage("Fixing payment ID - {$payment->id} with new currency {$payment->currency_id}"); }); } diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php index c3dab168c0..47855b9213 100644 --- a/tests/Feature/ClientTest.php +++ b/tests/Feature/ClientTest.php @@ -619,7 +619,7 @@ class ClientTest extends TestCase $data = [ 'name' => 'A loyal Client', - 'contacts' => $this->faker->unique()->safeEmail(), + 'contacts' => \Illuminate\Support\Str::random(32)."@example.com", ]; try { @@ -674,7 +674,7 @@ class ClientTest extends TestCase $data = [ 'name' => 'A loyal Client', 'contacts' => [ - ['email' => $this->faker->unique()->safeEmail()], + ['email' => \Illuminate\Support\Str::random(32)."@example.com"], ], ]; @@ -690,7 +690,7 @@ class ClientTest extends TestCase 'name' => 'A loyal Client', 'contacts' => [ [ - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => '*****', ], ], @@ -706,7 +706,7 @@ class ClientTest extends TestCase 'name' => 'A loyal Client', 'contacts' => [ [ - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => '1', ], ], @@ -728,7 +728,7 @@ class ClientTest extends TestCase 'name' => 'A loyal Client', 'contacts' => [ [ - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => '1Qajsj...33', ], ], @@ -751,11 +751,11 @@ class ClientTest extends TestCase 'name' => 'A loyal Client', 'contacts' => [ [ - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => '1Qajsj...33', ], [ - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => '1234AAAAAaaaaa', ], ], @@ -786,7 +786,7 @@ class ClientTest extends TestCase $arr = $response->json(); - $safe_email = $this->faker->unique()->safeEmail(); + $safe_email = \Illuminate\Support\Str::random(32)."@example.com"; $data = [ 'name' => 'A loyal Client', @@ -820,7 +820,7 @@ class ClientTest extends TestCase $this->assertEquals(0, strlen($contact->password)); - $safe_email = $this->faker->unique()->safeEmail(); + $safe_email = \Illuminate\Support\Str::random(32)."@example.com"; $data = [ 'name' => 'A loyal Client', diff --git a/tests/Feature/Export/ArDetailReportTest.php b/tests/Feature/Export/ArDetailReportTest.php index 1a726911b3..67529a7816 100644 --- a/tests/Feature/Export/ArDetailReportTest.php +++ b/tests/Feature/Export/ArDetailReportTest.php @@ -88,7 +88,7 @@ class ArDetailReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ArSummaryReportTest.php b/tests/Feature/Export/ArSummaryReportTest.php index 513ba917e3..f3512b65bb 100644 --- a/tests/Feature/Export/ArSummaryReportTest.php +++ b/tests/Feature/Export/ArSummaryReportTest.php @@ -85,7 +85,7 @@ class ArSummaryReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ClientBalanceReportTest.php b/tests/Feature/Export/ClientBalanceReportTest.php index 6624e7afa3..6d2452a30f 100644 --- a/tests/Feature/Export/ClientBalanceReportTest.php +++ b/tests/Feature/Export/ClientBalanceReportTest.php @@ -85,7 +85,7 @@ class ClientBalanceReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ClientSalesReportTest.php b/tests/Feature/Export/ClientSalesReportTest.php index 2c626d6782..b4cf846229 100644 --- a/tests/Feature/Export/ClientSalesReportTest.php +++ b/tests/Feature/Export/ClientSalesReportTest.php @@ -85,7 +85,7 @@ class ClientSalesReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ProductSalesReportTest.php b/tests/Feature/Export/ProductSalesReportTest.php index 4b137cbdca..7225b93fef 100644 --- a/tests/Feature/Export/ProductSalesReportTest.php +++ b/tests/Feature/Export/ProductSalesReportTest.php @@ -89,7 +89,7 @@ class ProductSalesReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ProfitAndLossReportTest.php b/tests/Feature/Export/ProfitAndLossReportTest.php index d13e4412d7..791d0bf8a7 100644 --- a/tests/Feature/Export/ProfitAndLossReportTest.php +++ b/tests/Feature/Export/ProfitAndLossReportTest.php @@ -88,7 +88,7 @@ class ProfitAndLossReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/ReportCsvGenerationTest.php b/tests/Feature/Export/ReportCsvGenerationTest.php index eb0d8ff955..8dc3fafce9 100644 --- a/tests/Feature/Export/ReportCsvGenerationTest.php +++ b/tests/Feature/Export/ReportCsvGenerationTest.php @@ -207,7 +207,7 @@ class ReportCsvGenerationTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Export/UserSalesReportTest.php b/tests/Feature/Export/UserSalesReportTest.php index ad2adc9a6a..87c4784ee5 100644 --- a/tests/Feature/Export/UserSalesReportTest.php +++ b/tests/Feature/Export/UserSalesReportTest.php @@ -88,7 +88,7 @@ class UserSalesReportTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/Inventory/InventoryManagementTest.php b/tests/Feature/Inventory/InventoryManagementTest.php index d93683a218..bd3dc41bae 100644 --- a/tests/Feature/Inventory/InventoryManagementTest.php +++ b/tests/Feature/Inventory/InventoryManagementTest.php @@ -45,6 +45,9 @@ class InventoryManagementTest extends TestCase public function testInventoryMovements() { + + config(['queue.default' => 'sync']); + $product = Product::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, diff --git a/tests/Feature/MultiPaymentDeleteTest.php b/tests/Feature/MultiPaymentDeleteTest.php index 222811d8a6..4174ece70f 100644 --- a/tests/Feature/MultiPaymentDeleteTest.php +++ b/tests/Feature/MultiPaymentDeleteTest.php @@ -56,7 +56,7 @@ class MultiPaymentDeleteTest extends TestCase $user = User::factory()->create([ 'account_id' => $account->id, 'confirmation_code' => '11', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $cu = CompanyUserFactory::create($user->id, $company->id, $account->id); diff --git a/tests/Feature/QuoteReminderTest.php b/tests/Feature/QuoteReminderTest.php index d8db0d72ad..4427fb9a87 100644 --- a/tests/Feature/QuoteReminderTest.php +++ b/tests/Feature/QuoteReminderTest.php @@ -87,7 +87,7 @@ class QuoteReminderTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); if(!$settings) { diff --git a/tests/Feature/ReminderTest.php b/tests/Feature/ReminderTest.php index 4f32465cda..27a8b29981 100644 --- a/tests/Feature/ReminderTest.php +++ b/tests/Feature/ReminderTest.php @@ -87,7 +87,7 @@ class ReminderTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); if(!$settings) { @@ -295,7 +295,7 @@ class ReminderTest extends TestCase $user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index a86511c18a..e58da9c745 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -73,7 +73,7 @@ class UserTest extends TestCase $user = User::factory()->create([ 'account_id' => $account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $user->password = \Illuminate\Support\Facades\Hash::make('ALongAndBriliantPassword'); @@ -204,7 +204,7 @@ class UserTest extends TestCase $data = $user->toArray(); - $data['email'] = $this->faker->unique()->safeEmail(); + $data['email'] = \Illuminate\Support\Str::random(32)."@example.com"; unset($data['password']); $response = $this->withHeaders([ @@ -357,7 +357,7 @@ class UserTest extends TestCase $user = User::factory()->create([ 'account_id' => $account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => \Illuminate\Support\Facades\Hash::make('ALongAndBriliantPassword'), ]); diff --git a/tests/Integration/Einvoice/Storecove/StorecoveRouterTest.php b/tests/Integration/Einvoice/Storecove/StorecoveRouterTest.php index 2efc331df7..d7806e47aa 100644 --- a/tests/Integration/Einvoice/Storecove/StorecoveRouterTest.php +++ b/tests/Integration/Einvoice/Storecove/StorecoveRouterTest.php @@ -50,7 +50,7 @@ class StorecoveRouterTest extends TestCase $user = User::factory()->create([ 'account_id' => $account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", 'password' => \Illuminate\Support\Facades\Hash::make('ALongAndBriliantPassword'), ]); diff --git a/tests/Integration/Einvoice/Storecove/StorecoveTest.php b/tests/Integration/Einvoice/Storecove/StorecoveTest.php index c00ce7692b..c845bb750b 100644 --- a/tests/Integration/Einvoice/Storecove/StorecoveTest.php +++ b/tests/Integration/Einvoice/Storecove/StorecoveTest.php @@ -1018,7 +1018,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Lazio'; $settings->postal_code = '00187'; $settings->phone = '06 1234567'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '380'; // Italy's ISO country code $settings->vat_number = 'IT92443356490'; // Italian VAT number $settings->id_number = 'RM 123456'; // Typical Italian company registration format @@ -1181,7 +1181,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Berlin'; $settings->postal_code = '10115'; $settings->phone = '030 1234567'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '276'; // Germany's ISO country code $settings->vat_number = 'DE123456789'; $settings->id_number = 'HRB 98765'; @@ -1289,7 +1289,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Madrid'; $settings->postal_code = '28013'; $settings->phone = '030 1234567'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '724'; // Germany's ISO country code $settings->vat_number = 'ESB16645678'; $settings->id_number = 'HRB 12345'; @@ -1397,7 +1397,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Île-de-France'; $settings->postal_code = '75002'; $settings->phone = '01 23456789'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '250'; // France's ISO country code $settings->vat_number = 'FR82345678911'; $settings->id_number = '12345678900010'; @@ -1508,7 +1508,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Vienna'; $settings->postal_code = '1010'; $settings->phone = '+43 1 23456789'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '40'; // Austria's ISO country code $settings->vat_number = 'ATU92335648'; $settings->id_number = 'FN 123456x'; @@ -1617,7 +1617,7 @@ $this->assertTrue(in_array($item->tax_id, ['1','2'])); $settings->state = 'Bucharest'; $settings->postal_code = '010101'; $settings->phone = '021 1234567'; - $settings->email = $this->faker->unique()->safeEmail(); + $settings->email = \Illuminate\Support\Str::random(32)."@example.com"; $settings->country_id = '642'; // Romania's ISO country code $settings->vat_number = 'RO92443356490'; // Romanian VAT number format $settings->id_number = 'B12345678'; // Typical Romanian company registration format diff --git a/tests/MockUnitData.php b/tests/MockUnitData.php index 6b4575af13..7679182cb3 100644 --- a/tests/MockUnitData.php +++ b/tests/MockUnitData.php @@ -56,7 +56,7 @@ trait MockUnitData $this->user = User::factory()->create([ 'account_id' => $this->account->id, - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $this->company = Company::factory()->create([ diff --git a/tests/Unit/CheckDataTest.php b/tests/Unit/CheckDataTest.php index 8e25ace823..1ed5c4af62 100644 --- a/tests/Unit/CheckDataTest.php +++ b/tests/Unit/CheckDataTest.php @@ -68,7 +68,7 @@ class CheckDataTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); @@ -182,12 +182,12 @@ class CheckDataTest extends TestCase User::factory()->create([ 'account_id' => $this->account->id, - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); User::factory()->create([ 'account_id' => $this->account->id, - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $user_hash = 'a'; diff --git a/tests/Unit/InvoiceMarkPaidTest.php b/tests/Unit/InvoiceMarkPaidTest.php index 3fb9629129..b7a9a6667d 100644 --- a/tests/Unit/InvoiceMarkPaidTest.php +++ b/tests/Unit/InvoiceMarkPaidTest.php @@ -79,7 +79,7 @@ class InvoiceMarkPaidTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $settings = CompanySettings::defaults(); diff --git a/tests/Unit/LateFeeTest.php b/tests/Unit/LateFeeTest.php index 565fdf54b7..8bf2a78e8f 100644 --- a/tests/Unit/LateFeeTest.php +++ b/tests/Unit/LateFeeTest.php @@ -70,7 +70,7 @@ class LateFeeTest extends TestCase $this->user = User::factory()->create([ 'account_id' => $this->account->id, 'confirmation_code' => 'xyz123', - 'email' => $this->faker->unique()->safeEmail(), + 'email' => \Illuminate\Support\Str::random(32)."@example.com", ]); $this->company = Company::factory()->create([ diff --git a/tests/Unit/RecurringExpenseCloneTest.php b/tests/Unit/RecurringExpenseCloneTest.php index 46fa54be8c..dcaba8385f 100644 --- a/tests/Unit/RecurringExpenseCloneTest.php +++ b/tests/Unit/RecurringExpenseCloneTest.php @@ -43,7 +43,7 @@ class RecurringExpenseCloneTest extends TestCase public function testBadBase64String() { $account = Account::factory()->create(); - $user = User::factory()->create(['account_id' => $account->id, 'email' => $this->faker->unique()->safeEmail()]); + $user = User::factory()->create(['account_id' => $account->id, 'email' => \Illuminate\Support\Str::random(32)."@example.com"]); $company = Company::factory()->create(['account_id' => $account->id]); $client = Client::factory()->create([