Add test for exising is_deceased behaviour on contact.get
authoreileen <eileen@fuzion.co.nz>
Tue, 27 Aug 2013 02:20:14 +0000 (14:20 +1200)
committerTim Otten <totten@civicrm.org>
Tue, 27 Aug 2013 23:51:23 +0000 (16:51 -0700)
tests/phpunit/api/v3/ContactTest.php

index b292b054fb99713c1747b7ee2730d04966650166..37017a6c62d556bdb0c0a95627723ec97bfdc082 100644 (file)
@@ -383,6 +383,17 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals('new employer org', $result['current_employer']);
 
   }
+  /**
+   * Check deceased contacts are not retrieved
+   * Note at time of writing the default is to return default. This should possibly be changed & test added
+   *
+   */
+  function testGetDeceasedNotRetrieved() {
+    $c1 = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $c2 = $this->callAPISuccess($this->_entity, 'create', array('first_name' => 'bb', 'last_name' => 'ccc', 'contact_type' => 'Individual', 'is_deceased' => 1));
+    $result = $this->callAPISuccess($this->_entity, 'get', array('is_deceased' => 0));
+    $this->assertFalse(array_key_exists($c2['id'], $result['values']));
+  }
 
   /*
      * Test that sort works - old syntax