1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4067 from turbo124/v2

Recurring due dates
This commit is contained in:
David Bomba 2020-09-14 22:16:01 +10:00 committed by GitHub
commit 859206eed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 1122 additions and 97 deletions

View File

@ -16,6 +16,7 @@ use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Models\Filterable; use App\Models\Filterable;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\Recurring\HasRecurrence;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -29,6 +30,8 @@ class RecurringInvoice extends BaseModel
use SoftDeletes; use SoftDeletes;
use Filterable; use Filterable;
use MakesDates; use MakesDates;
use HasRecurrence;
/** /**
* Invoice Statuses. * Invoice Statuses.
*/ */
@ -353,7 +356,7 @@ class RecurringInvoice extends BaseModel
*/ */
public function recurringDates() public function recurringDates()
{ {
info($this->next_send_date);
/* Return early if nothing to send back! */ /* Return early if nothing to send back! */
if( $this->status_id == self::STATUS_COMPLETED || if( $this->status_id == self::STATUS_COMPLETED ||
$this->status_id == self::STATUS_DRAFT || $this->status_id == self::STATUS_DRAFT ||
@ -387,7 +390,7 @@ class RecurringInvoice extends BaseModel
'due_date' => $next_due_date->format('Y-m-d'), 'due_date' => $next_due_date->format('Y-m-d'),
]; ];
$next_send_date = $this->nextDateByFrequency($next_send_date); $next_send_date = $this->calculateDueDate($next_send_date);
} }
@ -404,4 +407,35 @@ class RecurringInvoice extends BaseModel
} }
private function calculateDueDate($date)
{
switch ($this->due_date_days) {
case 'terms':
return $this->calculateDateFromTerms($date);
break;
default:
return $this->setDayOfMonth($date, $this->due_date_days);
break;
}
}
/**
* Calculates a date based on the client payment terms.
*
* @param Carbon $date A given date
* @return NULL|Carbon The date
*/
public function calculateDateFromTerms($date)
{
$client_payment_terms = $this->client->getSetting('payment_terms');
if($client_payment_terms == '')//no due date! return null;
return null;
return $date->copy()->addDays($client_payment_terms); //add the number of days in the payment terms to the date
}
} }

View File

@ -131,7 +131,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3, 'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3,
'custom_surcharge_tax4' => (bool) $invoice->custom_surcharge_tax4, 'custom_surcharge_tax4' => (bool) $invoice->custom_surcharge_tax4,
'line_items' => $invoice->line_items ?: (array) [], 'line_items' => $invoice->line_items ?: (array) [],
'entity_type' => 'recurring_invoice', 'entity_type' => 'recurringInvoice',
'frequency_id' => (string) $invoice->frequency_id, 'frequency_id' => (string) $invoice->frequency_id,
'remaining_cycles' => (int) $invoice->remaining_cycles, 'remaining_cycles' => (int) $invoice->remaining_cycles,
'recurring_dates' => (array) $invoice->recurringDates(), 'recurring_dates' => (array) $invoice->recurringDates(),

View File

@ -0,0 +1,71 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Utils\Traits\Recurring;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
trait HasRecurrence
{
/**
* Calculates the first day of the month, this will ALWAYS
* be the first of NEXT month
*
* @param Carbon $date The given date
* @return Carbon The first of NEXT month
*/
public function calculateFirstDayOfMonth($date)
{
return $date->copy()->startOfMonth()->addMonth();
}
/**
* Calculates the last day of the month.
*
* If it is the last day of the month - we add a month on.
*
* @param Carbon $date The start date
* @return Carbon The last day of month
*/
public function calculateLastDayOfMonth($date)
{
if($date->isLastOfMonth())
return $date->copy()->addMonthNoOverflow()->endOfMonth();
return $date->copy()->endOfMonth();
}
/**
* Sets the day of the month, if in the past we ADD a month
*
* @param Carbon $date The start date
* @param String|Int $day_of_month The day of the month
*/
public function setDayOfMonth($date, $day_of_month)
{
$set_date = $date->copy()->setUnitNoOverflow('day', $day_of_month, 'month');
//If the set date is less than the original date we need to add a month.
//If we are overflowing dates, then we need to diff the dates and ensure it doesn't equal 0
if($set_date->lte($date) || $set_date->diffInDays($date) == 0)
$set_date->addMonthNoOverflow();
if($day_of_month == '31')
$set_date->endOfMonth();
return $set_date;
}
}

View File

@ -70,7 +70,7 @@ class AddIsPublicToDocumentsTable extends Migration
Schema::table('recurring_invoices', function (Blueprint $table) { Schema::table('recurring_invoices', function (Blueprint $table) {
$table->integer('remaining_cycles')->nullable()->change(); $table->integer('remaining_cycles')->nullable()->change();
$table->dropColumn('start_date'); $table->dropColumn('start_date');
$table->integer('due_date_days')->nullable(); $table->string('due_date_days')->nullable();
$table->date('partial_due_date')->nullable(); $table->date('partial_due_date')->nullable();
}); });
} }

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Factory\CreditFactory; use App\Factory\CreditFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\CompanyGateway; use App\Models\CompanyGateway;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\Account; use App\Models\Account;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\Account; use App\Models\Account;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Feature; namespace Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Feature; namespace Feature;
use App\Helpers\Email\InvoiceEmail; use App\Helpers\Email\InvoiceEmail;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Feature; namespace Feature;
use App\Jobs\Account\CreateAccount; use App\Jobs\Account\CreateAccount;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature\PdfMaker; namespace Tests\Feature\PdfMaker;
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers; use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature\PdfMaker; namespace Tests\Feature\PdfMaker;
use App\Models\Invoice; use App\Models\Invoice;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature\PdfMaker; namespace Tests\Feature\PdfMaker;
use App\Services\PdfMaker\Design; use App\Services\PdfMaker\Design;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Models\Account; use App\Models\Account;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Jobs\Account\CreateAccount; use App\Jobs\Account\CreateAccount;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Factory\CreditFactory; use App\Factory\CreditFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature\Shop; namespace Tests\Feature\Shop;
use App\Factory\CompanyUserFactory; use App\Factory\CompanyUserFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Feature; namespace Feature;
use App\Factory\CompanyUserFactory; use App\Factory\CompanyUserFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Feature; namespace Tests\Feature;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase; use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase; use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Models\Invoice; use App\Models\Invoice;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Models\Company; use App\Models\Company;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Events\Invoice\InvoiceWasUpdated; use App\Events\Invoice\InvoiceWasUpdated;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Designs\Bold; use App\Designs\Bold;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Jobs\Invoice\CreateInvoicePdf; use App\Jobs\Invoice\CreateInvoicePdf;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Models\Account; use App\Models\Account;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Factory\CompanyUserFactory; use App\Factory\CompanyUserFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration\PaymentDrivers; namespace Tests\Integration\PaymentDrivers;
use App\Factory\PaymentFactory; use App\Factory\PaymentFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Jobs\Invoice\EmailInvoice; use App\Jobs\Invoice\EmailInvoice;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase; use Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Http\ValidationRules\NewUniqueUserRule; use App\Http\ValidationRules\NewUniqueUserRule;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Events\Invoice\InvoiceWasCreated; use App\Events\Invoice\InvoiceWasCreated;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Models\CompanyUser; use App\Models\CompanyUser;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Events\Invoice\InvoiceWasCreated; use App\Events\Invoice\InvoiceWasCreated;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration; namespace Tests\Integration;
use App\Events\Invoice\InvoiceWasCreated; use App\Events\Invoice\InvoiceWasCreated;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Pdf; namespace Tests\Pdf;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\CloneQuoteToInvoiceFactory; use App\Factory\CloneQuoteToInvoiceFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Models\PaymentTerm; use App\Models\PaymentTerm;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Jobs\Util\UploadFile; use App\Jobs\Util\UploadFile;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\CompanySettings; use App\DataMapper\CompanySettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use Tests\TestCase; use Tests\TestCase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Libraries\Currency\Conversion\CurrencyApi; use App\Libraries\Currency\Conversion\CurrencyApi;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceFactory; use App\Factory\InvoiceFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\DefaultSettings; use App\DataMapper\DefaultSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\ClientContactFactory; use App\Factory\ClientContactFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceInvitationFactory; use App\Factory\InvoiceInvitationFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\PaymentFactory; use App\Factory\PaymentFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceFactory; use App\Factory\InvoiceFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceItemFactory; use App\Factory\InvoiceItemFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceItemFactory; use App\Factory\InvoiceItemFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceItemFactory; use App\Factory\InvoiceItemFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceFactory; use App\Factory\InvoiceFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use Tests\TestCase; use Tests\TestCase;

View File

@ -1,4 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit\Migration; namespace Tests\Unit\Migration;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit\Migration; namespace Tests\Unit\Migration;
use App\Exceptions\MigrationValidatorFailed; use App\Exceptions\MigrationValidatorFailed;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use Tests\TestCase; use Tests\TestCase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Models\Currency; use App\Models\Currency;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\DataMapper\ClientSettings; use App\DataMapper\ClientSettings;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\CloneQuoteToInvoiceFactory; use App\Factory\CloneQuoteToInvoiceFactory;
@ -52,7 +60,7 @@ class RecurringDatesTest extends TestCase
$recurring_invoice->status_id = RecurringInvoice::STATUS_PENDING; $recurring_invoice->status_id = RecurringInvoice::STATUS_PENDING;
$recurring_invoice->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY; $recurring_invoice->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY;
$recurring_invoice->remaining_cycles = 5; $recurring_invoice->remaining_cycles = 5;
$recurring_invoice->due_date_days = 5; $recurring_invoice->due_date_days = '5';
$recurring_invoice->next_send_date = now(); $recurring_invoice->next_send_date = now();
$recurring_invoice->save(); $recurring_invoice->save();

View File

@ -0,0 +1,175 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit;
use App\Utils\Traits\Recurring\HasRecurrence;
use Illuminate\Support\Carbon;
use Tests\TestCase;
/**
* @test
* @covers App\Utils\Traits\Recurring\HasRecurrence
*/
class RecurringDueDatesTest extends TestCase
{
use HasRecurrence;
public function testFirstDate()
{
$date = Carbon::parse('2020-02-15');
$due_date = $this->calculateFirstDayOfMonth($date);
$this->assertEquals('2020-03-01', $due_date->format('Y-m-d'));
}
public function testFirstOfMonthOnFirst()
{
$date = Carbon::parse('2020-02-01');
$due_date = $this->calculateFirstDayOfMonth($date);
$this->assertEquals('2020-03-01', $due_date->format('Y-m-d'));
}
public function testFirstOfMonthOnLast()
{
$date = Carbon::parse('2020-03-31');
$due_date = $this->calculateFirstDayOfMonth($date);
$this->assertEquals('2020-04-01', $due_date->format('Y-m-d'));
}
public function testLastOfMonth()
{
$date = Carbon::parse('2020-02-15');
$due_date = $this->calculateLastDayOfMonth($date);
$this->assertEquals('2020-02-29', $due_date->format('Y-m-d'));
}
public function testLastOfMonthOnFirst()
{
$date = Carbon::parse('2020-02-1');
$due_date = $this->calculateLastDayOfMonth($date);
$this->assertEquals('2020-02-29', $due_date->format('Y-m-d'));
}
public function testLastOfMonthOnLast()
{
$date = Carbon::parse('2020-02-29');
$due_date = $this->calculateLastDayOfMonth($date);
$this->assertEquals('2020-03-31', $due_date->format('Y-m-d'));
}
public function testDayOfMonth()
{
$date = Carbon::parse('2020-02-01');
$due_date = $this->setDayOfMonth($date, '15');
$this->assertEquals('2020-02-15', $due_date->format('Y-m-d'));
}
public function testDayOfMonthInFuture()
{
$date = Carbon::parse('2020-02-16');
$due_date = $this->setDayOfMonth($date, '15');
$this->assertEquals('2020-03-15', $due_date->format('Y-m-d'));
}
public function testDayOfMonthSameDay()
{
$date = Carbon::parse('2020-02-01');
$due_date = $this->setDayOfMonth($date, '1');
$this->assertEquals('2020-03-01', $due_date->format('Y-m-d'));
}
public function testDayOfMonthWithOverflow()
{
$date = Carbon::parse('2020-1-31');
$due_date = $this->setDayOfMonth($date, '31');
$this->assertEquals('2020-02-29', $due_date->format('Y-m-d'));
}
public function testDayOfMonthWithOverflow2()
{
$date = Carbon::parse('2020-02-29');
$due_date = $this->setDayOfMonth($date, '31');
$this->assertEquals('2020-03-31', $due_date->format('Y-m-d'));
}
public function testDayOfMonthWithOverflow3()
{
$date = Carbon::parse('2020-01-30');
$due_date = $this->setDayOfMonth($date, '30');
$this->assertEquals('2020-02-29', $due_date->format('Y-m-d'));
}
public function testDayOfMonthWithOverflow4()
{
$date = Carbon::parse('2019-02-28');
$due_date = $this->setDayOfMonth($date, '31');
$this->assertEquals('2019-03-31', $due_date->format('Y-m-d'));
}
public function testDayOfMonthWithOverflow5()
{
$date = Carbon::parse('2019-1-31');
$due_date = $this->setDayOfMonth($date, '31');
$this->assertEquals('2019-02-28', $due_date->format('Y-m-d'));
}
}

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit\Shop; namespace Tests\Unit\Shop;
use App\Factory\InvoiceFactory; use App\Factory\InvoiceFactory;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Utils\SystemHealth; use App\Utils\SystemHealth;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use Illuminate\Support\Facades\Lang; use Illuminate\Support\Facades\Lang;

View File

@ -1,5 +1,13 @@
<?php <?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit; namespace Tests\Unit;
use App\Factory\InvoiceFactory; use App\Factory\InvoiceFactory;