Commit 9ddbd6c552c3b3089c2119ed5e81640a9c5be67a

Authored by Kevin Cyster
1 parent 4de3a79d

Changed the tests for saved searches that do not exist. Have taken into account …

…existing saved searches

Committed By: Kevin Cyster
Reviewed By: Megan Watson

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@9755 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 28 additions and 10 deletions
tests/api/testSavedSearches.php
... ... @@ -81,22 +81,33 @@ class savedSearchTestCase extends KTUnitTestCase {
81 81 $searchID = $this->savedSearch->create('test_search', '(GeneralText contains "title")');
82 82 $list = $this->savedSearch->getList();
83 83  
84   - $searchID = $list[0]['id'];
85   - $search = $this->savedSearch->getSavedSearch($searchID);
86   -
87   - $this->assertNotNull($search);
  84 + foreach($list as $item){
  85 + if($item['id'] == $searchID){
  86 + $search = $item['id'];
  87 + break;
  88 + }
  89 + }
  90 + $savedSearch = $this->savedSearch->getSavedSearch($search);
  91 +
  92 + $this->assertNotNull($savedSearch);
88 93 $this->assertNoErrors();
89   -
90 94 $this->savedSearch->delete($searchID);
91 95  
92 96 // case 2: search does NOT exists
93   - $array = array();
94 97 $list = $this->savedSearch->getList();
  98 + $inList = FALSE;
  99 + foreach($list as $item){
  100 + if($item['id'] == $searchID){
  101 + $inList = TRUE;
  102 + break;
  103 + }
  104 + }
95 105  
96 106 $this->assertNotA($list, 'PEAR_Error');
97   - $this->assertEqual($list, $array);
  107 + $this->assertFalse($inList);
98 108 $this->assertNoErrors();
99   - }
  109 +
  110 + }
100 111  
101 112 /**
102 113 * This method tests the list of the saved search
... ... @@ -115,11 +126,18 @@ class savedSearchTestCase extends KTUnitTestCase {
115 126  
116 127 $this->savedSearch->delete($searchID);
117 128  
118   - // case 2: saved searches do NOT exist
  129 + // case 2: saved search does NOT exist
119 130 $list = $this->savedSearch->getList();
120 131  
  132 + $inList = FALSE;
  133 + foreach($list as $item){
  134 + if($item['id'] == $searchID){
  135 + $inList = TRUE;
  136 + break;
  137 + }
  138 + }
121 139 $this->assertNotA($list, 'PEAR_Error');
122   - $this->assertEqual($list, $array);
  140 + $this->assertFalse($inList);
123 141 $this->assertNoErrors();
124 142 }
125 143  
... ...