function DateTimePlusTest::testUnserializeWithInvalidDateTimeObject
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testUnserializeWithInvalidDateTimeObject()
Tests unserializing a payload whose $dateTimeObject is not a date.
File
-
core/
tests/ Drupal/ Tests/ Component/ Datetime/ DateTimePlusTest.php, line 1121
Class
Namespace
Drupal\Tests\Component\DatetimeCode
public function testUnserializeWithInvalidDateTimeObject() : void {
$serialized = "O:38:\"Drupal\\Component\\Datetime\\DateTimePlus\":3:{s:11:\"\x00*\x00langcode\";N;s:9:\"\x00*\x00errors\";a:0:{}s:17:\"\x00*\x00dateTimeObject\";s:8:\"not-date\";}";
$this->expectException(\TypeError::class);
unserialize($serialized);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.