CRM-15443 - add unit test to ensure getlist api does not return deleted or deceased...
authorColeman Watts <coleman@civicrm.org>
Sun, 12 Oct 2014 23:21:10 +0000 (19:21 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 12 Oct 2014 23:21:10 +0000 (19:21 -0400)
tests/phpunit/api/v3/ContactTest.php

index ff46898e4022e20272376a0d44be1f4591c7155c..62e99a4a691e01d216397cc683d20107bf99bc53 100644 (file)
@@ -1851,4 +1851,18 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('contact', 'get', array('city' => 'Cool City', 'return' => 'contact_type'));
     $this->assertEquals(1, $result['count']);
   }
+
+
+  /**
+   * CRM-15443 - ensure getlist api does not return deleted or deceased contacts
+   */
+  function testGetlistExcludeConditions() {
+    $name = md5(time());
+    $contact1 = $this->individualCreate(array('last_name' => $name, 'is_deceased' => 1));
+    $contact2 = $this->individualCreate(array('last_name' => $name, 'is_deleted' => 1));
+    $contact3 = $this->individualCreate(array('last_name' => $name));
+    $result = $this->callAPISuccess('contact', 'getlist', array('input' => $name));
+    $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
+    $this->assertEquals($contact3, $result['values'][0]['id'], 'In line ' . __LINE__);
+  }
 }