Skip to content

Commit

Permalink
Merge pull request #1837 from eri-trabiccolo/test-time-comparing
Browse files Browse the repository at this point in the history
Compare dates using UNIX timestamps
  • Loading branch information
Thomas Patrick Levy authored Oct 26, 2021
2 parents a8b4310 + 3a65ead commit b5f2127
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @since 3.21.0
* @since 3.33.0 Add test for the `llms_bulk_delete_user_postmeta` function.
* @since 4.5.1 Fix failing `test_delete_user_postmeta()` which was comparing based on array order when that doesn't strictly matter.
* @version [version]
*/
class LLMS_Test_Functions_User_Postmeta extends LLMS_UnitTestCase {

Expand Down Expand Up @@ -177,6 +178,7 @@ public function test_bulk_delete_user_postmeta() {
*
* @since 3.21.0
* @since 5.3.2 Add delta when comparing enrollment date with updated date.
* @since [version] Compare dates using UNIX timestamps.
*/
public function test_llms_get_user_postmeta() {

Expand All @@ -190,9 +192,9 @@ public function test_llms_get_user_postmeta() {
$this->assertEquals( $data, llms_get_user_postmeta( $this->student_id, $this->course_id, '_test_serialized_data' ) );

// Test updated date.
$enrollment_date = $this->student->get_enrollment_date( $this->course_id, 'enrolled', 'Y-m-d H:i:s' );
$enrollment_date = $this->student->get_enrollment_date( $this->course_id, 'enrolled', 'U' );
$updated_date = llms_get_user_postmeta( $this->student_id, $this->course_id, '_status', true, 'updated_date' );
$this->assertEqualsWithDelta( $enrollment_date, $updated_date, 2 );
$this->assertEqualsWithDelta( $enrollment_date, strtotime( $updated_date ), 2 );

}

Expand Down

0 comments on commit b5f2127

Please sign in to comment.