Download src/php/php-src/ext/date/tests/DatePeriod_uninitialised_exceptions.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/date/tests/DatePeriod_uninitialised_exceptions.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/date/tests/DatePeriod_uninitialised_exceptions.phpt
-
curl -L -o DatePeriod_uninitialised_exceptions.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/date/tests/DatePeriod_uninitialised_exceptions.phpt
1.23 kB
| --TEST-- | |
| DateTime uninitialised exceptions | |
| --INI-- | |
| date.timezone=Europe/London | |
| --FILE-- | |
| class MyDatePeriod extends DatePeriod | |
| { | |
| function __construct() | |
| { | |
| } | |
| } | |
| function check(callable $c) | |
| { | |
| try { | |
| var_dump($c()); | |
| } catch (\DateObjectError $e) { | |
| echo $e::class, ': ', $e->getMessage(), "\n"; | |
| } | |
| } | |
| $mdp = new MyDatePeriod(); | |
| check(fn() => serialize($mdp)); | |
| check(fn() => $mdp->getStartDate()); | |
| check(fn() => $mdp->getDateInterval()); | |
| check(function() use ($mdp) { | |
| foreach($mdp as $foo) | |
| { | |
| } | |
| }); | |
| /* Allowed to be empty */ | |
| check(fn() => $mdp->getEndDate()); | |
| check(fn() => $mdp->getRecurrences()); | |
| --EXPECTF-- | |
| DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor | |
| DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor | |
| DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor | |
| DateObjectError: Object of type DatePeriod has not been correctly initialized by calling parent::__construct() in its constructor | |
| NULL | |
| NULL | |