Skip to:
Content

BuddyPress.org

Changeset 9294


Ignore:
Timestamp:
01/02/2015 07:57:52 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Unit tests for bp_format_time() to test gmt_offset and timezone_string. See #2693.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/functions.php

    r9192 r9294  
    186186        $then = $now + 100;
    187187        $this->assertEquals( 'sometime ago', bp_core_time_since( $then, $now ) );
     188    }
     189
     190    /**
     191     * @group bp_format_time
     192     */
     193    public function test_bp_format_time_gmt_offset() {
     194        $time          = 1395169200;
     195        $gmt_offset    = '-6';
     196        $just_date     = false;
     197        $localize_time = true;
     198
     199        update_option( 'gmt_offset', $gmt_offset );
     200        delete_option( 'timezone_string' );
     201
     202        $this->assertEquals( 'March 18, 2014 at 1:00 pm', bp_format_time( $time, $just_date, $localize_time ) );
     203    }
     204
     205    /**
     206     * @group bp_format_time
     207     */
     208    public function test_bp_format_time_timezone_string() {
     209        $time           = 1395169200;
     210        $timzone_string = 'America/Chicago';
     211        $just_date      = false;
     212        $localize_time  = true;
     213
     214        update_option( 'timezone_string', $timzone_string );
     215        delete_option( 'gmt_offset' );
     216
     217        $this->assertEquals( 'March 18, 2014 at 1:00 pm', bp_format_time( $time, $just_date, $localize_time ) );
    188218    }
    189219
Note: See TracChangeset for help on using the changeset viewer.