Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
57 / 57
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_functions_validate_date_test
100.00% covered (success)
100.00%
57 / 57
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 setUp
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 test_validate_date
100.00% covered (success)
100.00%
55 / 55
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14require_once __DIR__ . '/../../phpBB/includes/functions_user.php';
15require_once __DIR__ . '/validate_data_helper.php';
16
17class phpbb_functions_validate_date_test extends phpbb_test_case
18{
19    protected $helper;
20
21    protected function setUp(): void
22    {
23        parent::setUp();
24
25        $this->helper = new phpbb_functions_validate_data_helper($this);
26    }
27
28    public function test_validate_date()
29    {
30        $this->helper->assert_valid_data(array(
31            'empty' => array(
32                array('INVALID'),
33                '',
34                array('date'),
35            ),
36            'empty_opt' => array(
37                array(),
38                '',
39                array('date', true),
40            ),
41            'double_single' => array(
42                array(),
43                '17-06-1990',
44                array('date'),
45            ),
46            'single_single' => array(
47                array(),
48                '05-05-2009',
49                array('date'),
50            ),
51            'double_double' => array(
52                array(),
53                '17-12-1990',
54                array('date'),
55            ),
56            'month_high' => array(
57                array('INVALID'),
58                '17-17-1990',
59                array('date'),
60            ),
61            'month_low' => array(
62                array('INVALID'),
63                '01-00-1990',
64                array('date'),
65            ),
66            'day_high' => array(
67                array('INVALID'),
68                '64-01-1990',
69                array('date'),
70            ),
71            'day_low' => array(
72                array('INVALID'),
73                '00-12-1990',
74                array('date'),
75            ),
76            // Currently fails
77            /*
78            'zero_year' => array(
79                array(),
80                '01-01-0000',
81                array('date'),
82            ),
83            */
84        ));
85    }
86}