Commit bdbea906c37e34d944f4b3914189de72835e786a
1 parent
9bb733bd
Removed assert statements that were breaking the unit tests.
Committed by: Megan Watson
Showing
3 changed files
with
17 additions
and
8 deletions
ktapi/KTAPIDocument.inc.php
| @@ -103,10 +103,15 @@ class KTAPI_Document extends KTAPI_FolderItem | @@ -103,10 +103,15 @@ class KTAPI_Document extends KTAPI_FolderItem | ||
| 103 | */ | 103 | */ |
| 104 | function &get(&$ktapi, $documentid, $iMetadataVersionId = null) | 104 | function &get(&$ktapi, $documentid, $iMetadataVersionId = null) |
| 105 | { | 105 | { |
| 106 | - assert(!is_null($ktapi)); | ||
| 107 | - assert(is_a($ktapi, 'KTAPI')); | ||
| 108 | - assert(is_numeric($documentid)); | 106 | + if(is_null($ktapi) || !is_a($ktapi, 'KTAPI')){ |
| 107 | + return PEAR::raiseError('A valid KTAPI object is needed'); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if(!is_numeric($documentid)){ | ||
| 111 | + return PEAR::raiseError('A valid document id is required'); | ||
| 112 | + } | ||
| 109 | 113 | ||
| 114 | + // ensure documentid is an integer | ||
| 110 | $documentid += 0; | 115 | $documentid += 0; |
| 111 | 116 | ||
| 112 | $document = &Document::get($documentid, $iMetadataVersionId); | 117 | $document = &Document::get($documentid, $iMetadataVersionId); |
ktapi/KTAPIFolder.inc.php
| @@ -86,9 +86,13 @@ class KTAPI_Folder extends KTAPI_FolderItem | @@ -86,9 +86,13 @@ class KTAPI_Folder extends KTAPI_FolderItem | ||
| 86 | */ | 86 | */ |
| 87 | function get(&$ktapi, $folderid) | 87 | function get(&$ktapi, $folderid) |
| 88 | { | 88 | { |
| 89 | - assert(!is_null($ktapi)); | ||
| 90 | - assert(is_a($ktapi, 'KTAPI')); | ||
| 91 | - assert(is_numeric($folderid)); | 89 | + if(is_null($ktapi) || !is_a($ktapi, 'KTAPI')){ |
| 90 | + return PEAR::raiseError('A valid KTAPI object is needed'); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + if(!is_numeric($folderid)){ | ||
| 94 | + return PEAR::raiseError('A valid folder id is required'); | ||
| 95 | + } | ||
| 92 | 96 | ||
| 93 | $folderid += 0; | 97 | $folderid += 0; |
| 94 | 98 |
tests/runtests.php
| @@ -52,9 +52,9 @@ class UnitTests extends TestSuite { | @@ -52,9 +52,9 @@ class UnitTests extends TestSuite { | ||
| 52 | // $this->addFile('filelike/testStringFileLike.php'); | 52 | // $this->addFile('filelike/testStringFileLike.php'); |
| 53 | 53 | ||
| 54 | // Search (2) and indexing | 54 | // Search (2) and indexing |
| 55 | -// $this->addFile('documentProcessor/testExtracters.php'); | 55 | + $this->addFile('documentProcessor/testExtracters.php'); |
| 56 | // $this->addFile('documentProcessor/testGuidInserter.php'); | 56 | // $this->addFile('documentProcessor/testGuidInserter.php'); |
| 57 | -// $this->addFile('search2/testSearch.php'); | 57 | + $this->addFile('search2/testSearch.php'); |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 |