mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for tests
This commit is contained in:
parent
ba672f6fdd
commit
7618666c4b
@ -65,7 +65,7 @@ class CheckData extends Command
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'ninja:check-data';
|
||||
protected $signature = 'ninja:check-data {--database=} {--fix=}';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -46,7 +46,7 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
$schedule->job(new VersionCheck)->daily();
|
||||
|
||||
$schedule->command('ninja:check-data')->daily()->withoutOverlapping();
|
||||
$schedule->command('ninja:check-data --database=db-ninja-01')->daily()->withoutOverlapping();
|
||||
|
||||
$schedule->job(new ReminderJob)->daily()->withoutOverlapping();
|
||||
|
||||
@ -65,6 +65,7 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
$schedule->job(new AdjustEmailQuota)->daily()->withoutOverlapping();
|
||||
$schedule->job(new SendFailedEmails)->daily()->withoutOverlapping();
|
||||
$schedule->command('ninja:check-data --database=db-ninja-02')->daily()->withoutOverlapping();
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,6 @@ class CompanyObserver
|
||||
|
||||
if(Ninja::isHosted() && $company->portal_mode == 'domain' && $company->isDirty('portal_domain'))
|
||||
{
|
||||
nlog('company observer - updated');
|
||||
nlog($company->portal_domain);
|
||||
nlog($company->getOriginal('portal_domain'));
|
||||
|
||||
//fire event to build new custom portal domain
|
||||
\Modules\Admin\Jobs\Domain\CustomDomain::dispatch($company->getOriginal('portal_domain'), $company)->onQueue('domain');
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ class InvoiceObserver
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company);
|
||||
}
|
||||
|
||||
if($invoice->isDirty('date') || $invoice->isDirty('due_date'))
|
||||
$invoice->service()->setReminder()->save();
|
||||
// if($invoice->isDirty('date') || $invoice->isDirty('due_date'))
|
||||
// $invoice->service()->setReminder()->save();
|
||||
|
||||
// UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath() . $invoice->numberFormatter().'.pdf');
|
||||
|
||||
|
@ -169,10 +169,14 @@ class BaseRepository
|
||||
*/
|
||||
protected function alternativeSave($data, $model)
|
||||
{
|
||||
|
||||
if (array_key_exists('client_id', $data)) //forces the client_id if it doesn't exist
|
||||
//forces the client_id if it doesn't exist
|
||||
if(array_key_exists('client_id', $data))
|
||||
$model->client_id = $data['client_id'];
|
||||
|
||||
//pickup changes here to recalculate reminders
|
||||
if($model instanceof Invoice && ($model->isDirty('date') || $model->isDirty('due_date')))
|
||||
$model->service()->setReminder()->save();
|
||||
|
||||
$client = Client::where('id', $model->client_id)->withTrashed()->first();
|
||||
|
||||
$state = [];
|
||||
@ -189,7 +193,7 @@ class BaseRepository
|
||||
$data = array_merge($company_defaults, $data);
|
||||
}
|
||||
|
||||
$tmp_data = $data; //preserves the $data arrayss
|
||||
$tmp_data = $data; //preserves the $data array
|
||||
|
||||
/* We need to unset some variable as we sometimes unguard the model */
|
||||
if (isset($tmp_data['invitations']))
|
||||
|
@ -245,6 +245,13 @@ class InvoiceService
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReminder($settings = null)
|
||||
{
|
||||
$this->invoice = (new UpdateReminder($this->invoice, $settings))->run();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
@ -425,13 +432,6 @@ class InvoiceService
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReminder($settings = null)
|
||||
{
|
||||
$this->invoice = (new UpdateReminder($this->invoice, $settings))->run();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the invoice.
|
||||
|
@ -21,7 +21,7 @@ class UpdateReminder extends AbstractService
|
||||
|
||||
public $settings;
|
||||
|
||||
public function __construct($invoice, $settings = null)
|
||||
public function __construct(Invoice $invoice, $settings = null)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->settings = $settings;
|
||||
|
@ -7,7 +7,11 @@
|
||||
<p>Looks like your migration failed. Here's the error message:</p>
|
||||
|
||||
<pre>
|
||||
@if(Ninja::isHosted())
|
||||
There was a problem with your migration, please send us an email contact@invoiceninja.com
|
||||
@else
|
||||
{!! $exception->getMessage() !!}
|
||||
{!! $content !!}
|
||||
@endif
|
||||
</pre>
|
||||
@endcomponent
|
||||
|
@ -19,7 +19,6 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @covers App\Utils\Traits\MakesReminders
|
||||
*/
|
||||
class CheckRemindersTest extends TestCase
|
||||
{
|
||||
@ -50,6 +49,8 @@ class CheckRemindersTest extends TestCase
|
||||
$settings->num_days_reminder3 = 1;
|
||||
|
||||
$this->company->settings = $settings;
|
||||
$this->company->save();
|
||||
|
||||
$this->invoice->service()->markSent();
|
||||
$this->invoice->service()->setReminder($settings)->save();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user