Changeset 7101
- Timestamp:
- 05/24/2013 01:26:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/core/functions.php
r7054 r7101 41 41 } 42 42 43 /** 44 * @group bp_core_time_since 45 */ 46 public function test_bp_core_time_since_years_months() { 47 $now = time(); 48 $then = $now - ( 3 * YEAR_IN_SECONDS ) - ( 3 * 30 * DAY_IN_SECONDS ); 49 $this->assertEquals( '3 years, 3 months ago', bp_core_time_since( $then, $now ) ); 50 } 51 52 /** 53 * @group bp_core_time_since 54 */ 55 public function test_bp_core_time_since_years_nomonths() { 56 $now = time(); 57 $then = $now - ( 3 * YEAR_IN_SECONDS ); 58 $this->assertEquals( '3 years ago', bp_core_time_since( $then, $now ) ); 59 } 60 61 /** 62 * @group bp_core_time_since 63 */ 64 public function test_bp_core_time_since_months_weeks() { 65 $now = time(); 66 $then = $now - ( 3 * 30 * DAY_IN_SECONDS ) - ( 3 * WEEK_IN_SECONDS ); 67 $this->assertEquals( '3 months, 3 weeks ago', bp_core_time_since( $then, $now ) ); 68 } 69 70 /** 71 * @group bp_core_time_since 72 */ 73 public function test_bp_core_time_since_months_noweeks() { 74 $now = time(); 75 $then = $now - ( 3 * 30 * DAY_IN_SECONDS ); 76 $this->assertEquals( '3 months ago', bp_core_time_since( $then, $now ) ); 77 } 78 79 /** 80 * @group bp_core_time_since 81 */ 82 public function test_bp_core_time_since_weeks_days() { 83 $now = time(); 84 $then = $now - ( 3 * WEEK_IN_SECONDS ) - ( 3 * DAY_IN_SECONDS ); 85 $this->assertEquals( '3 weeks, 3 days ago', bp_core_time_since( $then, $now ) ); 86 } 87 88 /** 89 * @group bp_core_time_since 90 */ 91 public function test_bp_core_time_since_weeks_nodays() { 92 $now = time(); 93 $then = $now - ( 3 * WEEK_IN_SECONDS ); 94 $this->assertEquals( '3 weeks ago', bp_core_time_since( $then, $now ) ); 95 } 96 97 /** 98 * @group bp_core_time_since 99 */ 100 public function test_bp_core_time_since_days_hours() { 101 $now = time(); 102 $then = $now - ( 3 * DAY_IN_SECONDS ) - ( 3 * HOUR_IN_SECONDS ); 103 $this->assertEquals( '3 days, 3 hours ago', bp_core_time_since( $then, $now ) ); 104 } 105 106 /** 107 * @group bp_core_time_since 108 */ 109 public function test_bp_core_time_since_days_nohours() { 110 $now = time(); 111 $then = $now - ( 3 * DAY_IN_SECONDS ); 112 $this->assertEquals( '3 days ago', bp_core_time_since( $then, $now ) ); 113 } 114 115 /** 116 * @group bp_core_time_since 117 */ 118 public function test_bp_core_time_since_hours_minutes() { 119 $now = time(); 120 $then = $now - ( 3 * HOUR_IN_SECONDS ) - ( 3 * MINUTE_IN_SECONDS ); 121 $this->assertEquals( '3 hours, 3 minutes ago', bp_core_time_since( $then, $now ) ); 122 } 123 124 /** 125 * @group bp_core_time_since 126 */ 127 public function test_bp_core_time_since_hours_nominutes() { 128 $now = time(); 129 $then = $now - ( 3 * HOUR_IN_SECONDS ); 130 $this->assertEquals( '3 hours ago', bp_core_time_since( $then, $now ) ); 131 } 132 133 /** 134 * @group bp_core_time_since 135 * @ticket BP5017 136 */ 137 public function test_bp_core_time_since_minutes_seconds() { 138 $now = time(); 139 $then = $now - ( 3 * MINUTE_IN_SECONDS ) - 3; 140 $this->assertEquals( '3 minutes, 3 seconds ago', bp_core_time_since( $then, $now ) ); 141 } 142 143 /** 144 * @group bp_core_time_since 145 */ 146 public function test_bp_core_time_since_minutes_noseconds() { 147 $now = time(); 148 $then = $now - ( 3 * MINUTE_IN_SECONDS ); 149 $this->assertEquals( '3 minutes ago', bp_core_time_since( $then, $now ) ); 150 } 151 152 /** 153 * @group bp_core_time_since 154 */ 155 public function test_bp_core_time_since_seconds() { 156 $now = time(); 157 $then = $now - 3; 158 $this->assertEquals( '3 seconds ago', bp_core_time_since( $then, $now ) ); 159 } 160 161 /** 162 * @group bp_core_time_since 163 */ 164 public function test_bp_core_time_since_rightnow() { 165 $now = time(); 166 $then = $now; 167 $this->assertEquals( 'right now', bp_core_time_since( $then, $now ) ); 168 } 169 170 /** 171 * @group bp_core_time_since 172 */ 173 public function test_bp_core_time_since_future() { 174 $now = time(); 175 $then = $now + 100; 176 $this->assertEquals( 'sometime ago', bp_core_time_since( $then, $now ) ); 177 } 178 43 179 }
Note: See TracChangeset
for help on using the changeset viewer.