diff --git a/tests/documentmanagement/documentTypeTest.php b/tests/documentmanagement/documentTypeTest.php index 11f49df..5411ce1 100644 --- a/tests/documentmanagement/documentTypeTest.php +++ b/tests/documentmanagement/documentTypeTest.php @@ -25,12 +25,17 @@ global $default; $docManager = new DocumentManager(); +$docManager->deleteDocumentType("Test Document"); +$docManager->deleteDocumentTypeField("Test Field"); + +echo "Testing creation of document types
"; if ($docManager->createDocumentType("Test")) { echo "Passed document type creation test
"; } else { echo "Failed 'document type creation' test: " . $default->errorMessage . "
"; } +echo "Testing creation of duplicate document types
"; //test creation of duplicate document types if (!$docManager->createDocumentType("Test")) { echo "Passed 'duplicate document type creation' test
"; @@ -38,6 +43,7 @@ if (!$docManager->createDocumentType("Test")) { echo "Failed duplicate document type creation test
"; } +echo "Testing deletion of document types
"; //test deletion of an existing document type if ($docManager->deleteDocumentType("Test")) { echo "Passed 'existing document type deletion' test
"; @@ -45,6 +51,7 @@ if ($docManager->deleteDocumentType("Test")) { echo "Failed existing document type deletion test
"; } +echo "Testing deletion of non-existant document types
"; //test deletion of a document type that doesn't exist if (!$docManager->deleteDocumentType("Does not exist")) { echo "Passed 'deletion of non-existing document type' test
"; @@ -58,6 +65,7 @@ if (!$docManager->deleteDocumentType("Does not exist")) { * */ +echo "Testing creation of document field types
"; //test creation of a field if ($docManager->createDocumentTypeField("Test Field","VARCHAR")) { echo "Passed 'creation of document type field' test
"; @@ -65,6 +73,7 @@ if ($docManager->createDocumentTypeField("Test Field","VARCHAR")) { echo "Failed 'creation of document type field' test
"; } +echo "Testing creation of duplicate document field types
"; //test creation of duplicate field if (!($docManager->createDocumentTypeField("Test Field","VARCHAR"))) { echo "Passed 'creation of duplicate document type field ' test
"; @@ -72,6 +81,7 @@ if (!($docManager->createDocumentTypeField("Test Field","VARCHAR"))) { echo "Failed 'creation of duplicated document type field ' test
: $default->errorMessage"; } +echo "Testing deletion of document field types
"; //test deletion of a field if ($docManager->deleteDocumentTypeField("Test Field")) { echo "Passed 'deletion of document type field ' test
"; @@ -79,6 +89,7 @@ if ($docManager->deleteDocumentTypeField("Test Field")) { echo "Failed 'deletion of document type field ' test<
"; } +echo "Testing deletion of non-existant document types
"; //test deletion of a non-existant field if (!$docManager->deleteDocumentTypeField("Test Field that doesn't exist")) { echo "Passed 'deletion of non-existant document type field ' test
"; @@ -86,8 +97,38 @@ if (!$docManager->deleteDocumentTypeField("Test Field that doesn't exist")) { echo "Failed 'deletion of non-existant document type field ' test<
"; } +/** +* +* Document type, document field type link test +* +*/ +echo "Testing linking of document types and document field types
"; +//test the linking of a document to a document field type +$docManager->createDocumentType("Test Document"); +$docManager->createDocumentTypeField("Test Field", "VARCHAR"); + +$documentTypeID = $docManager->getDocumentTypeID("Test Document"); +$documentTypeFieldID = $docManager->getDocumentTypeFieldID("Test Field"); +if (!(is_bool($documentTypeID)) && !(is_bool($documentTypeField))) { + echo "Passed document type and document type field id retreival test
"; + if ($docManager->createDocumentTypeFieldLink($documentTypeID, $documentTypeFieldID, true)) { + echo "Passed linking of document types and document field types test
"; + } else { + echo "Passed linking of document types and document field types test: " . $default->errorMessage . "
"; + } +} else { + echo "Failed document type and document type field id retreival test: " . $default->errorMessage . "
"; +} +echo "Testing deletion of link between document types and document field types
"; +if ($docManager->deleteDocumentTypeFieldLink($documentTypeID, $documentTypeFieldID)) { + echo "Passed deletion of link between document types and document field types
"; +} else { + echo "Failed deletion of link between document types and document field types
"; +} +$docManager->deleteDocumentType("Test Document"); +$docManager->deleteDocumentTypeField("Test Field"); ?>