Static analysis and cleanup for tests

This commit is contained in:
David Bomba 2025-08-15 10:37:42 +10:00
parent d5a7cab86c
commit a89e51ebdc
15 changed files with 35 additions and 7 deletions

View File

@ -39,7 +39,8 @@ class ProtectedDownloadController extends BaseController
return response()->streamDownload(function () use ($hashed_path) { return response()->streamDownload(function () use ($hashed_path) {
$stream = Storage::readStream($hashed_path); $stream = Storage::readStream($hashed_path);
if ($stream === false) { // if($stream ===false){
if ($stream === null) {
throw new SystemError('Unable to read file', 500); throw new SystemError('Unable to read file', 500);
} }

View File

@ -60,6 +60,7 @@ class ConnectNordigenBankIntegrationRequest extends Request
/** /**
* @return array{ * @return array{
* user_id: int, * user_id: int,
* bank_account_id?: string,
* company_key: string, * company_key: string,
* context: string, * context: string,
* is_react: bool, * is_react: bool,

View File

@ -150,6 +150,7 @@ class PaymentScheduleRequest extends Request
RecurringInvoice::FREQUENCY_ANNUALLY => $date->startOfDay()->addYear(), RecurringInvoice::FREQUENCY_ANNUALLY => $date->startOfDay()->addYear(),
RecurringInvoice::FREQUENCY_TWO_YEARS => $date->startOfDay()->addYears(2), RecurringInvoice::FREQUENCY_TWO_YEARS => $date->startOfDay()->addYears(2),
RecurringInvoice::FREQUENCY_THREE_YEARS => $date->startOfDay()->addYears(3), RecurringInvoice::FREQUENCY_THREE_YEARS => $date->startOfDay()->addYears(3),
default => $date->startOfDay()->addMonthNoOverflow(),
}; };
} }
} }

View File

@ -118,7 +118,7 @@ class InvoiceTransactionEventEntry
return new TransactionEventMetadata([ return new TransactionEventMetadata([
'tax_report' => [ 'tax_report' => [
'tax_details' => $details, 'tax_details' => $details,
'payment_history' => $this->payments->toArray() ?? [], 'payment_history' => $this->payments->toArray() ?? [], //@phpstan-ignore-line
'tax_summary' => [ 'tax_summary' => [
'total_taxes' => $invoice->total_taxes, 'total_taxes' => $invoice->total_taxes,
'total_paid' => $this->getTotalTaxPaid($invoice), 'total_paid' => $this->getTotalTaxPaid($invoice),

View File

@ -75,6 +75,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property bool $is_trial * @property bool $is_trial
* @property int $e_invoice_quota * @property int $e_invoice_quota
* @property int $docuninja_num_users * @property int $docuninja_num_users
* @property string|null $e_invoicing_token
* @property-read int|null $bank_integrations_count * @property-read int|null $bank_integrations_count
* @property-read int|null $companies_count * @property-read int|null $companies_count
* @property-read int|null $company_users_count * @property-read int|null $company_users_count

View File

@ -87,6 +87,9 @@ use Illuminate\Contracts\Translation\HasLocalePreference;
* @property-read \App\Models\User $user * @property-read \App\Models\User $user
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company
* @property-read \App\Models\Country|null $country * @property-read \App\Models\Country|null $country
* @property-read \App\Models\Industry|null $industry
* @property-read \App\Models\Country|null $shipping_country
* @property-read \App\Models\Size|null $size
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts

View File

@ -123,6 +123,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property string|null $inbound_mailbox_blacklist * @property string|null $inbound_mailbox_blacklist
* @property string|null $e_invoice_certificate_passphrase * @property string|null $e_invoice_certificate_passphrase
* @property string|null $e_invoice_certificate * @property string|null $e_invoice_certificate
* @property object|null $origin_tax_data
* @property int $deleted_at * @property int $deleted_at
* @property string|null $smtp_username * @property string|null $smtp_username
* @property string|null $smtp_password * @property string|null $smtp_password

View File

@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $created_at * @property int|null $created_at
* @property int|null $updated_at * @property int|null $updated_at
* @property int|null $deleted_at * @property int|null $deleted_at
* @property string|null $entities
* @property-read \App\Models\Company|null $company * @property-read \App\Models\Company|null $company
* @property-read string $hashed_id * @property-read string $hashed_id
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()

View File

@ -66,19 +66,20 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property float $tax_amount3 * @property float $tax_amount3
* @property bool $uses_inclusive_taxes * @property bool $uses_inclusive_taxes
* @property bool $calculate_tax_by_amount * @property bool $calculate_tax_by_amount
* @property-read int|null $documents_count
* @property-read mixed $hashed_id
* @property-read \App\Models\User|null $assigned_user * @property-read \App\Models\User|null $assigned_user
* @property-read \App\Models\ExpenseCategory|null $category * @property-read \App\Models\ExpenseCategory|null $category
* @property-read \App\Models\Client|null $client * @property-read \App\Models\Client|null $client
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company
* @property-read \App\Models\Currency|null $currency * @property-read \App\Models\Currency|null $currency
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read int|null $documents_count
* @property-read mixed $hashed_id
* @property-read \App\Models\PaymentType|null $payment_type * @property-read \App\Models\PaymentType|null $payment_type
* @property-read \App\Models\Project|null $project * @property-read \App\Models\Project|null $project
* @property-read \App\Models\PurchaseOrder|null $purchase_order * @property-read \App\Models\PurchaseOrder|null $purchase_order
* @property-read \App\Models\User $user * @property-read \App\Models\User $user
* @property-read \App\Models\Vendor|null $vendor * @property-read \App\Models\Vendor|null $vendor
* @property-read \App\Models\Currency|null $invoice_currency
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Database\Factories\ExpenseFactory factory($count = null, $state = []) * @method static \Database\Factories\ExpenseFactory factory($count = null, $state = [])

View File

@ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property bool $is_deleted * @property bool $is_deleted
* @property string|null $number * @property string|null $number
* @property string $color * @property string $color
* @property int|null $current_hours
* @property-read \App\Models\Client|null $client * @property-read \App\Models\Client|null $client
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company
* @property-read int|null $documents_count * @property-read int|null $documents_count

View File

@ -101,6 +101,8 @@ use App\Events\PurchaseOrder\PurchaseOrderWasEmailed;
* @property \App\Models\User $user * @property \App\Models\User $user
* @property \App\Models\Vendor $vendor * @property \App\Models\Vendor $vendor
* @property \App\Models\PurchaseOrderInvitation $invitation * @property \App\Models\PurchaseOrderInvitation $invitation
* @property \App\Models\Currency|null $currency
* @property \App\Models\Location|null $location
* @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder exclude($columns)
* @method static \Database\Factories\PurchaseOrderFactory factory($count = null, $state = []) * @method static \Database\Factories\PurchaseOrderFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder filter(\App\Filters\QueryFilters $filters) * @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder filter(\App\Filters\QueryFilters $filters)

View File

@ -56,6 +56,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property float $promo_price * @property float $promo_price
* @property int $registration_required * @property int $registration_required
* @property int $use_inventory_management * @property int $use_inventory_management
* @property string|null $steps
* @property string|null $optional_product_ids * @property string|null $optional_product_ids
* @property string|null $optional_recurring_product_ids * @property string|null $optional_recurring_product_ids
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company

View File

@ -59,6 +59,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $language_id * @property int|null $language_id
* @property int|null $last_login * @property int|null $last_login
* @property bool $is_tax_exempt * @property bool $is_tax_exempt
* @property string|null $classification
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read int|null $activities_count * @property-read int|null $activities_count
* @property-read \App\Models\Language|null $language * @property-read \App\Models\Language|null $language

View File

@ -650,6 +650,21 @@ $this->account->forceDelete();
'public_notes' => 'Public5', 'public_notes' => 'Public5',
'private_notes' => 'Private5', 'private_notes' => 'Private5',
'terms' => 'Terms5', 'terms' => 'Terms5',
'tax_rate1' => 0,
'tax_rate2' => 0,
'tax_rate3' => 0,
'discount' => 0,
'line_items' => [
[
'quantity' => 1,
'product_key' => 'product_key',
'notes' => 'notes',
'cost' => 1000,
'custom_value1' => 'Custom 1',
'custom_value2' => 'Custom 2',
'custom_value3' => 'Custom 3',
]
]
]); ]);

View File

@ -50,9 +50,7 @@ class UpdateExchangeRatesTest extends TestCase
UpdateExchangeRates::dispatchSync(); UpdateExchangeRates::dispatchSync();
$gbp_currency = app('currencies')->first(function ($item) { $gbp_currency = \App\Models\Currency::find(2);
return $item->id == 2;
});
$this->assertEquals($currency_api->rates->GBP, $gbp_currency->exchange_rate); $this->assertEquals($currency_api->rates->GBP, $gbp_currency->exchange_rate);