Skip to:
Content

bbPress.org

Changeset 7759


Ignore:
Timestamp:
09/30/2026 06:13:50 AM (4 weeks ago)
Author:
johnjamesjacoby
Message:

Tests: Stabilize topic activity assertions.

Assert the stored last-active timestamp and update return value instead of comparing relative labels calculated at different seconds. Keep a nonempty freshness check.

In trunk, for 2.7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/topics/functions/update-last-thing.php

    r6090 r7759  
    8181                ) );
    8282
    83                 $r1_time_raw       = get_post_field( 'post_date', $r1 );
    84                 $r1_time_formatted = bbp_get_time_since( bbp_convert_date( $r1_time_raw ) );
     83                $r1_time_raw = get_post_field( 'post_date', $r1 );
    8584
    8685                $time = bbp_update_topic_last_active_time( $t, $r1_time_raw );
    8786                $this->assertSame( $r1_time_raw, $time );
    8887
    89                 $time = bbp_get_topic_last_active_time( $t );
    90                 $this->assertSame( $r1_time_formatted, $time );
     88                $this->assertSame( $r1_time_raw, get_post_meta( $t, '_bbp_last_active_time', true ) );
     89                $this->assertNotSame( '', bbp_get_topic_last_active_time( $t ) );
    9190
    9291                $r2 = $this->factory->reply->create_many( 2, array(
    … …  
    9897                ) );
    9998
    100                 $r2_time_raw       = get_post_field( 'post_date', $r2[1] );
    101                 $r2_time_formatted = bbp_get_time_since( bbp_convert_date( $r2_time_raw ) );
     99                $r2_time_raw = get_post_field( 'post_date', $r2[1] );
    102100
    103                 bbp_update_topic_last_active_time( $t );
    104                 $time = bbp_get_topic_last_active_time( $t );
    105                 $this->assertSame( $r2_time_formatted, $time );
     101                $time = bbp_update_topic_last_active_time( $t );
     102                $this->assertSame( $r2_time_raw, $time );
     103                $this->assertSame( $r2_time_raw, get_post_meta( $t, '_bbp_last_active_time', true ) );
     104                $this->assertNotSame( '', bbp_get_topic_last_active_time( $t ) );
    106105        }
    107106
Note: See TracChangeset for help on using the changeset viewer.