DatePeriod_properties2.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. DatePeriod: Test cannot modify read only properties
  3. --INI--
  4. date.timezone=UTC
  5. --FILE--
  6. <?php
  7. $period = new DatePeriod(new DateTime, new DateInterval('P1D'), new DateTime);
  8. $properties = [
  9. "recurrences",
  10. "include_start_date",
  11. "start",
  12. "current",
  13. "end",
  14. "interval",
  15. ];
  16. foreach ($properties as $property) {
  17. try {
  18. $period->$property = "new";
  19. } catch (Error $e) {
  20. echo $e->getMessage() . "\n";
  21. }
  22. try {
  23. $period->$property[] = "extra";
  24. } catch (Error $e) {
  25. echo $e->getMessage() . "\n";
  26. }
  27. }
  28. ?>
  29. --EXPECT--
  30. Writing to DatePeriod->recurrences is unsupported
  31. Retrieval of DatePeriod->recurrences for modification is unsupported
  32. Writing to DatePeriod->include_start_date is unsupported
  33. Retrieval of DatePeriod->include_start_date for modification is unsupported
  34. Writing to DatePeriod->start is unsupported
  35. Retrieval of DatePeriod->start for modification is unsupported
  36. Writing to DatePeriod->current is unsupported
  37. Retrieval of DatePeriod->current for modification is unsupported
  38. Writing to DatePeriod->end is unsupported
  39. Retrieval of DatePeriod->end for modification is unsupported
  40. Writing to DatePeriod->interval is unsupported
  41. Retrieval of DatePeriod->interval for modification is unsupported