Merge pull request #11642 from JKingsnorth/CRM-21739
[civicrm-core.git] / tests / phpunit / api / v3 / UtilsTest.php
index 4c91aa04fcaf0626f52b06e53032fb0cabcd041d..dcdee7c4a09405ddc54c6c79791bd239deee2a8b 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -432,4 +432,15 @@ class api_v3_UtilsTest extends CiviUnitTestCase {
     ), $r3['values']);
   }
 
+  /**
+   * CRM-20892 Add Tests of new timestamp checking function
+   */
+  public function testTimeStampChecking() {
+    CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing (id, modified_date) VALUES (25, '2016-06-30 12:52:52')");
+    $this->assertTrue(_civicrm_api3_compare_timestamps('2017-02-15 16:00:00', 25, 'Mailing'));
+    $this->callAPISuccess('Mailing', 'create', array('id' => 25, 'subject' => 'Test Subject'));
+    $this->assertFalse(_civicrm_api3_compare_timestamps('2017-02-15 16:00:00', 25, 'Mailing'));
+    $this->callAPISuccess('Mailing', 'delete', array('id' => 25));
+  }
+
 }