Upstream myclabs/DeepCopy state of the touched files before 7fb5af511d

This commit is contained in:
upstream committed 2026-09-03 14:34:44 +02:00
1 parent e6d94fc32a
commit e23bc8d851
2 files changed
+1 -52

No files matched your search

@@ -3,7 +3,6 @@
namespace DeepCopyTest\TypeFilter\Date;
use DateInterval;
use DateTimeImmutable;
use DeepCopy\TypeFilter\Date\DateIntervalFilter;
use PHPUnit\Framework\TestCase;
@@ -23,45 +22,4 @@ class DateIntervalFilterTest extends TestCase
$this->assertEquals($object, $copy);
$this->assertNotSame($object, $copy);
}
public function test_it_deep_copies_a_DateInterval_created_from_a_date_string()
{
$object = DateInterval::createFromDateString('2 days');
$filter = new DateIntervalFilter();
$copy = $filter->apply($object);
// The copy has to shift a date by the same amount as the original.
$base = new DateTimeImmutable('2026-01-01 00:00:00');
$this->assertSame(
$base->add($object)->format('Y-m-d H:i:s'),
$base->add($copy)->format('Y-m-d H:i:s')
);
$this->assertEquals($object, $copy);
$this->assertNotSame($object, $copy);
}
public function test_it_deep_copies_an_inverted_DateInterval_with_microseconds()
{
$object = new DateInterval('PT1S');
$object->invert = 1;
$object->f = 0.25;
$filter = new DateIntervalFilter();
$copy = $filter->apply($object);
$this->assertEquals($object, $copy);
$this->assertNotSame($object, $copy);
$base = new DateTimeImmutable('2026-01-01 00:00:00');
$this->assertSame(
$base->add($object)->format('Y-m-d H:i:s.u'),
$base->add($copy)->format('Y-m-d H:i:s.u')
);
}
}