Commit c1f39e82 authored by catch's avatar catch
Browse files

task: #3633170 Add test coverage for SA-CORE-2026-006

By: xjm
By: larowlan
By: mcdruid
By: mohit_aghera
By: smustgrave
(cherry picked from commit d32289b6)
parent 1131fffa
Loading
Loading
Loading
Loading
Loading
+9 −0
Changes for core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1115,4 +1115,13 @@ public function testGetPhpDateTime(): void {
    $this->assertEquals('America/New_York', $date_time_plus->getTimezone()->getName());
  }

  /**
   * Tests unserializing a payload whose $dateTimeObject is not a date.
   */
  public function testUnserializeWithInvalidDateTimeObject(): void {
    $serialized = "O:38:\"Drupal\\Component\\Datetime\\DateTimePlus\":3:{s:11:\"\0*\0langcode\";N;s:9:\"\0*\0errors\";a:0:{}s:17:\"\0*\0dateTimeObject\";s:8:\"not-date\";}";
    $this->expectException(\TypeError::class);
    unserialize($serialized);
  }

}