Make WordPress Core

Changeset 65170


Ignore:
Timestamp:
11/01/2026 05:34:03 PM (43 hours ago)
Author:
lancewillett
Message:

Tests: Cover date display and calendar cache clearing.

Cover XML date and weekday display with fixed dates. Extend weekday-date assertions for repeated output and filters, and verify delete_get_calendar_cache() targets the calendar cache entry.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/15238, ​https://github.com/WordPress/wordpress-develop/pull/15239, ​https://github.com/WordPress/wordpress-develop/pull/15318

Props devmuhib, huzaifaalmesbah.
See #65819.

Location:
trunk/tests/phpunit/tests
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/date/theDate.php

    r56971 r65170  
    129129        /**
    130130         * @ticket 47354
     131         * @ticket 65819
    131132         */
    132133        public function test_the_weekday_date() {
    … …  
    153154                the_weekday_date( 'before ', ' after' );
    154155                $this->assertSame( 'before Wednesday after', ob_get_clean() );
     156
     157                // Consecutive call on the same day should be suppressed.
     158                ob_start();
     159                the_weekday_date( 'before ', ' after' );
     160                $this->assertSame( '', ob_get_clean() );
     161
     162                add_filter(
     163                        'the_weekday_date',
     164                        static function ( $output ) {
     165                                return 'Filtered ' . $output;
     166                        }
     167                );
     168
     169                ob_start();
     170                $GLOBALS['currentday']      = '19.09.15';
     171                $GLOBALS['previousweekday'] = '18.09.15';
     172                the_weekday_date();
     173                $this->assertSame( 'Filtered Wednesday', ob_get_clean() );
    155174        }
    156175}
Note: See TracChangeset for help on using the changeset viewer.