more tests
authorSaurabh Batra <saurabh.batra96@gmail.com>
Wed, 3 Aug 2016 08:25:51 +0000 (13:55 +0530)
committerSaurabh Batra <saurabh.batra96@gmail.com>
Wed, 3 Aug 2016 08:25:51 +0000 (13:55 +0530)
tests/phpunit/api/v3/ValidateTest.php

index 62db6f9b4197c34bdd6c77f03d2905b1e18c0a81..881c9c5a1e655f960bf1741dc622cf9f9ccc9889 100644 (file)
@@ -66,4 +66,24 @@ class api_v3_ValidateTest extends CiviUnitTestCase {
     $this->assertEquals($validation['values'][0]['contact_id'], $contactIdErrors);
   }
 
+  public function testContributionDateValidate() {
+    $params = array(
+      'action' => "create",
+      'financial_type_id' => "1",
+      'total_amount' => "100",
+      'contact_id' => "1",
+      'receive_date' => 'abc',
+    );
+    $validation = $this->callAPISuccess('Contribution', 'validate', $params);
+
+    $expectedOut = array(
+      'receive_date' => array(
+        'message' => "receive_date is not a valid date: abc",
+        'code' => "incorrect_value",
+      ),
+    );
+
+    $this->assertEquals($validation['values'][0], $expectedOut);
+  }
+
 }