]> granicus.if.org Git - php/blob
715ea63dc9
[php] /
1 --TEST--
2 DatePeriod: Test wrong recurrence parameter on __construct
3 --FILE--
4 <?php
5 try {
6     new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'), 0);
7 } catch (Exception $exception) {
8     echo $exception->getMessage(), "\n";
9 }
10
11 try {
12     new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'),-1);
13 } catch (Exception $exception) {
14     echo $exception->getMessage(), "\n";
15 }
16 ?>
17 --EXPECTF--
18 DatePeriod::__construct(): The recurrence count '0' is invalid. Needs to be > 0
19 DatePeriod::__construct(): The recurrence count '-1' is invalid. Needs to be > 0