ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectTest Class Reference
+ Inheritance diagram for ilObjectTest:
+ Collaboration diagram for ilObjectTest:

Public Member Functions

 testCreationDeletion ()
 IL_Init
 testSetGetLookup ()
 IL_Init
 testTreeTrash ()
 IL_Init
 testObjectReference ()
 test object reference queries IL_Init

Protected Member Functions

 setUp ()

Protected Attributes

 $backupGlobals = FALSE

Detailed Description

Definition at line 4 of file ilObjectTest.php.

Member Function Documentation

ilObjectTest::setUp ( )
protected

Definition at line 8 of file ilObjectTest.php.

{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
ilObjectTest::testCreationDeletion ( )

IL_Init

Definition at line 17 of file ilObjectTest.php.

References ilObject\_exists().

{
$obj = new ilObject();
$obj->setType("xxx");
$obj->create();
$id = $obj->getId();
$obj2 = new ilObject();
$obj2->setType("xxx");
$obj2->create();
$id2 = $obj2->getId();
if ($id2 == ($id + 1))
{
$value.= "create1-";
}
{
$value.= "create2-";
}
$obj->delete();
$obj2->delete();
if (!ilObject::_exists($id))
{
$value.= "create3-";
}
$this->assertEquals("create1-create2-create3-", $value);
}

+ Here is the call graph for this function:

ilObjectTest::testObjectReference ( )

test object reference queries IL_Init

Definition at line 266 of file ilObjectTest.php.

References ilObject\_getAllReferences(), ilObject\_lookupDeletedDate(), ilObject\_resetDeletedDate(), and ilObject\_setDeletedDate().

{
include_once './Services/Object/classes/class.ilObject.php';
$this->assertEquals($date, null);
}

+ Here is the call graph for this function:

ilObjectTest::testSetGetLookup ( )

IL_Init

Definition at line 54 of file ilObjectTest.php.

References $ilUser, $ref_id, ilObject\_getAllReferences(), ilObject\_getIdsForTitle(), ilObject\_getObjectsByType(), ilObject\_lookupDeletedDate(), ilObject\_lookupDescription(), ilObject\_lookupLastUpdate(), ilObject\_lookupObjectId(), ilObject\_lookupObjId(), ilObject\_lookupObjIdByImportId(), ilObject\_lookupOwner(), ilObject\_lookupOwnerName(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilObject\_resetDeletedDate(), and ilObject\_setDeletedDate().

{
global $ilUser;
$obj = new ilObject();
$obj->setType(""); // otherwise type check will fail
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($id, false);
if ($obj->getType() == "")
{
$value.= "sg1-";
}
if ($obj->getTitle() == "TestObject")
{
$value.= "sg2-";
}
if ($obj->getDescription() == "TestDescription")
{
$value.= "sg3-";
}
if ($obj->getImportId() == "imp_44")
{
$value.= "sg4-";
}
if ($obj->getOwner() == $ilUser->getId())
{
$value.= "sg5-";
}
$obj = new ilObject($ref_id);
if ($obj->getTitle() == "TestObject")
{
$value.= "sg6-";
}
if ($obj->getCreateDate() == ($lu = $obj->getLastUpdateDate()))
{
$value.= "sg7-";
}
$obj->setTitle("TestObject2");
sleep(2); // we want a different date here...
$obj->update();
$obj = new ilObject($ref_id);
if ($lu != ($lu2 = $obj->getLastUpdateDate()))
{
$value.= "up1-";
}
if ($obj->getTitle() == "TestObject2")
{
$value.= "up2-";
}
if ($id == ilObject::_lookupObjIdByImportId("imp_44"))
{
$value.= "lu1-";
}
if ($ilUser->getFullname() == ilObject::_lookupOwnerName(ilObject::_lookupOwner($id)))
{
$value.= "lu2-";
}
if (ilObject::_lookupTitle($id) == "TestObject2")
{
$value.= "lu3-";
}
if (ilObject::_lookupDescription($id) == "TestDescription")
{
$value.= "lu4-";
}
if (ilObject::_lookupLastUpdate($id) == $lu2)
{
$value.= "lu5-";
}
{
$value.= "lu6-";
}
if (ilObject::_lookupType($id) == "")
{
$value.= "lu7-";
}
{
$value.= "lu8-";
}
if (is_array($ar) && count($ar) == 1 && $ar[$ref_id] == $ref_id)
{
$value.= "lu9-";
}
$ids = ilObject::_getIdsForTitle("TestObject2");
foreach ($ids as $i)
{
if ($i == $id)
{
$value.= "lu10-";
}
}
foreach ($obs as $ob)
{
if ($ob["obj_id"] == $ilUser->getId())
{
$value.= "lu11-";
}
}
if ($d1 != $d2 && $d1 == $d3 && $d3 == null)
{
$value.= "dd1-";
}
$obj->delete();
$this->assertEquals("sg1-sg2-sg3-sg4-sg5-sg6-sg7-up1-up2-".
"lu1-lu2-lu3-lu4-lu5-lu6-lu7-lu8-lu9-lu10-lu11-dd1-", $value);
}

+ Here is the call graph for this function:

ilObjectTest::testTreeTrash ( )

IL_Init

Definition at line 191 of file ilObjectTest.php.

References $ref_id, ilUtil\_getObjectsByOperations(), ilObject\_hasUntrashedReference(), ilObject\_isInTrash(), ilObject\_lookupObjId(), and ilObject\_lookupType().

{
global $tree;
$obj = new ilObject();
$obj->setType("xxx");
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($ref_id);
$obj->putInTree(ROOT_FOLDER_ID);
$obj->setPermissions(ROOT_FOLDER_ID);
if ($tree->isInTree($ref_id))
{
$value.= "tree1-";
}
{
$value.= "tree2-";
}
// isSaved() uses internal cache!
$tree->useCache(false);
$tree->saveSubTree($ref_id, true);
if ($tree->isDeleted($ref_id))
{
$value.= "tree3-";
}
if ($tree->isSaved($ref_id))
{
$value.= "tree4-";
}
{
$value.= "tree5-";
}
{
$value.= "tree6-";
}
$saved_tree = new ilTree(-(int)$ref_id);
$node_data = $saved_tree->getNodeData($ref_id);
$saved_tree->deleteTree($node_data);
{
$value.= "tree7-";
}
$obs = ilUtil::_getObjectsByOperations("cat","read");
foreach ($obs as $ob)
{
{
$value.= "nocat-";
}
}
$obj->delete();
$this->assertEquals("tree1-tree2-tree3-tree4-tree5-tree6-tree7-", $value);
}

+ Here is the call graph for this function:

Field Documentation

ilObjectTest::$backupGlobals = FALSE
protected

Definition at line 6 of file ilObjectTest.php.


The documentation for this class was generated from the following file: