mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-31 11:03:22 +01:00
With Expiry ticked and no date, new DateTime('') is now: every selected
line, MAG or Enigma device expired at once. The single edit had the
guard; the three mass edits did not. They now share
LineService::massExpiry(): a date, no expiry, or (no date, not a date)
nothing changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AneTzAHPPkYWPQjwyZ2td9
24 lines
1.0 KiB
PHP
24 lines
1.0 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use XcVm\Domain\Line\LineService;
|
|
|
|
/**
|
|
* The expiry a mass edit of lines, MAG or Enigma devices sets. With the box
|
|
* ticked and no date, `new DateTime('')` is now: every selected line expired
|
|
* at once. No date now leaves each line's own expiry.
|
|
*/
|
|
final class MassExpiryTest extends TestCase {
|
|
public function testNoDateLeavesEachLinesOwnExpiry(): void {
|
|
$this->assertFalse(LineService::massExpiry(['c_exp_date' => 'on', 'exp_date' => '']));
|
|
$this->assertFalse(LineService::massExpiry(['c_exp_date' => 'on', 'exp_date' => ' ']));
|
|
$this->assertFalse(LineService::massExpiry(['c_exp_date' => 'on']));
|
|
$this->assertFalse(LineService::massExpiry(['c_exp_date' => 'on', 'exp_date' => 'not a date']));
|
|
}
|
|
|
|
public function testADateOrNoExpiryIsSet(): void {
|
|
$this->assertSame((new DateTime('2027-01-31'))->format('U'), LineService::massExpiry(['exp_date' => '2027-01-31']));
|
|
$this->assertNull(LineService::massExpiry(['exp_date' => '', 'no_expire' => 'on']), 'no expiry asked for');
|
|
}
|
|
}
|