From eaa112a5c183bffd8b515afae40164bf161a3b53 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 12 Oct 2014 19:21:10 -0400 Subject: [PATCH] CRM-15443 - add unit test to ensure getlist api does not return deleted or deceased contacts --- tests/phpunit/api/v3/ContactTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index ff46898e40..62e99a4a69 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -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__); + } } -- 2.25.1