mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 16:31:33 +02:00
Fixes for tests
This commit is contained in:
parent
cb94973bd1
commit
1b60ee132e
@ -778,7 +778,12 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
|
|
||||||
$timezone = $this->company->timezone();
|
$timezone = $this->company->timezone();
|
||||||
|
|
||||||
$offset -= $timezone->utc_offset;
|
//2023-11-08 adjustments for DST
|
||||||
|
date_default_timezone_set('GMT');
|
||||||
|
$date = new \DateTime("now", new \DateTimeZone($timezone->name));
|
||||||
|
$offset -= $date->getOffset();
|
||||||
|
|
||||||
|
// $offset -= $timezone->utc_offset;
|
||||||
$offset += ($entity_send_time * 3600);
|
$offset += ($entity_send_time * 3600);
|
||||||
|
|
||||||
return $offset;
|
return $offset;
|
||||||
|
@ -928,7 +928,11 @@ class Company extends BaseModel
|
|||||||
|
|
||||||
$timezone = $this->timezone();
|
$timezone = $this->timezone();
|
||||||
|
|
||||||
$offset -= $timezone->utc_offset;
|
date_default_timezone_set('GMT');
|
||||||
|
$date = new \DateTime("now", new \DateTimeZone($timezone->name));
|
||||||
|
$offset -= $date->getOffset();
|
||||||
|
|
||||||
|
// $offset -= $timezone->utc_offset;
|
||||||
$offset += ($entity_send_time * 3600);
|
$offset += ($entity_send_time * 3600);
|
||||||
|
|
||||||
return $offset;
|
return $offset;
|
||||||
|
@ -322,15 +322,29 @@ class ReminderTest extends TestCase
|
|||||||
|
|
||||||
$this->travelTo(now()->startOfDay());
|
$this->travelTo(now()->startOfDay());
|
||||||
|
|
||||||
for($x=0; $x<46; $x++) {
|
$travel_date = Carbon::parse($this->invoice->next_send_date);
|
||||||
|
$x = false;
|
||||||
|
for($x=0; $x<50; $x++) {
|
||||||
|
|
||||||
// nlog("traveller {$x} ".now()->format('Y-m-d h:i:s'));
|
|
||||||
(new ReminderJob())->handle();
|
(new ReminderJob())->handle();
|
||||||
$this->invoice = $this->invoice->fresh();
|
|
||||||
$this->assertNull($this->invoice->reminder1_sent);
|
if(now()->gt($travel_date) && !$x) {
|
||||||
$this->assertNull($this->invoice->reminder_last_sent);
|
|
||||||
|
|
||||||
|
$this->assertNotNull($this->invoice->reminder1_sent);
|
||||||
|
$this->assertNotNull($this->invoice->reminder_last_sent);
|
||||||
|
$x=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!$x){
|
||||||
|
$this->invoice = $this->invoice->fresh();
|
||||||
|
$this->assertNull($this->invoice->reminder1_sent);
|
||||||
|
$this->assertNull($this->invoice->reminder_last_sent);
|
||||||
|
}
|
||||||
|
|
||||||
$this->travelTo(now()->addHours(1));
|
$this->travelTo(now()->addHours(1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nlog("traveller ".now()->format('Y-m-d'));
|
// nlog("traveller ".now()->format('Y-m-d'));
|
||||||
|
Loading…
Reference in New Issue
Block a user