fix tests

This commit is contained in:
Dennis Eichhorn 2023-09-21 15:20:42 +00:00
parent 2473992319
commit d78dfa7e74
3 changed files with 7 additions and 2 deletions

View File

@ -125,7 +125,7 @@ abstract class ModuleAbstract
$this->app = $app ?? new class() extends ApplicationAbstract {};
if (self::$auditor === null && static::ID !== 1006200000) {
self::$auditor = $this->app->moduleManager?->get('Auditor', 'Api');
self::$auditor = $this->app->moduleManager->get('Auditor', 'Api');
self::$auditor = self::$auditor === null || self::$auditor::ID === 0 ? null : self::$auditor;
}
}

View File

@ -114,7 +114,10 @@ class SmartDateTime extends \DateTime
$yearChange = (int) \floor(((int) $this->format('m') - 1 + $m) / 12);
$yearNew = (int) $this->format('Y') + $y + $yearChange;
$monthNew = ((int) $this->format('m') + $m - 1) % 12 + 1;
$monthNew = (int) $this->format('m') + $m;
$monthNew = $monthNew < 0
? 12 + ($monthNew - 1) % 12 + 1
: ($monthNew - 1) % 12 + 1;
$dayMonthOld = \cal_days_in_month($calendar, (int) $this->format('m'), (int) $this->format('Y'));
$dayMonthNew = \cal_days_in_month($calendar, $monthNew, $yearNew);

View File

@ -16,6 +16,8 @@ namespace phpOMS\tests\Stdlib\Base;
use phpOMS\Stdlib\Base\SmartDateTime;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Stdlib\Base\SmartDateTimeTest: DateTime type with additional functionality
*