| 1 | <?php |
| 2 | /** |
| 3 | * Tests is_new_date function |
| 4 | * |
| 5 | * @since 5.2.0 |
| 6 | * |
| 7 | * @group functions.php |
| 8 | */ |
| 9 | class Tests_Functions_is_new_date extends WP_UnitTestCase { |
| 10 | |
| 11 | public function _date_strings(){ |
| 12 | |
| 13 | return array( |
| 14 | array( 'same', 'same', true ), |
| 15 | array( 'same', 'diff', false ), |
| 16 | array( 'false', false, false ), // this should not be true |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * @dataProvider _date_strings |
| 23 | * |
| 24 | * @param string $currentday |
| 25 | * @param string $previousday |
| 26 | * @param bool $expected |
| 27 | */ |
| 28 | public function test_is_new_date( $currentday_string,$previousday_string , $expected ) { |
| 29 | global $currentday, $previousday; |
| 30 | |
| 31 | $currentday = $currentday_string; |
| 32 | $previousday = $previousday_string; |
| 33 | |
| 34 | $this->assertSame( is_new_day(), $expected ); |
| 35 | } |
| 36 | |
| 37 | } |