mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 16:48:42 +02:00
Add tests
This commit is contained in:
@@ -69,7 +69,7 @@ class InlineImageTest extends ItopDataTestCase
|
||||
$oInlineImage->SetDefaultOrgId();
|
||||
$this->assertEquals($iContactOrgId, $oInlineImage->Get('item_org_id'),'The org_id should be the one of the contact');
|
||||
|
||||
$oInlineImage = \MetaModel::NewObject('InlineImage',['item_class' => 'TriggerOnObjectCreation']);
|
||||
$oInlineImage = \MetaModel::NewObject('InlineImage',['item_class' => 'TriggerOnObjectCreate']);
|
||||
$oInlineImage->SetDefaultOrgId();
|
||||
$this->assertEquals(0, $oInlineImage->Get('item_org_id'),'The org_id should be left undefined');
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class InlineImageTest extends ItopDataTestCase
|
||||
$oInlineImage->SetDefaultOrgId();
|
||||
$this->assertEquals(0, $oInlineImage->Get('item_org_id'),'The org_id should be left undefined');
|
||||
|
||||
$oInlineImage = \MetaModel::NewObject('InlineImage',['item_class' => 'TriggerOnObjectCreation']);
|
||||
$oInlineImage = \MetaModel::NewObject('InlineImage',['item_class' => 'TriggerOnObjectCreate']);
|
||||
$oInlineImage->SetDefaultOrgId();
|
||||
$this->assertEquals(0, $oInlineImage->Get('item_org_id'),'The org_id should be left undefined');
|
||||
}
|
||||
|
||||
@@ -69,4 +69,25 @@ class TestAttachment extends ItopDataTestCase
|
||||
$oDocument = $oAttachment->Get('contents');
|
||||
$this->sRemoveAttachmentName = $oDocument->GetFileName();
|
||||
}
|
||||
|
||||
|
||||
public function testSetItemOnObjectWithDefinedOrganization()
|
||||
{
|
||||
$iOrgId = $this->GivenObjectInDB('Organization', ['name' => 'TestOrg']);
|
||||
$oUserRequest = $this->GivenObject('UserRequest', ['title' => 'TestUserRequest', 'org_id'=>$iOrgId]);
|
||||
|
||||
$oAttachment = new \Attachment();
|
||||
$oAttachment->SetItem($oUserRequest);
|
||||
$this->assertEquals($iOrgId, $oAttachment->Get('item_org_id'),'The org_id should be the one of the contact');
|
||||
}
|
||||
|
||||
|
||||
public function testSetItemOnObjectWithoutDefinedOrganization()
|
||||
{
|
||||
$oUserRequest = $this->GivenObject('TriggerOnObjectCreate', ['target_class' => 'UserRequest','description'=>'TestUserRequest']);
|
||||
|
||||
$oAttachment = new \Attachment();
|
||||
$oAttachment->SetItem($oUserRequest);
|
||||
$this->assertEquals(0, $oAttachment->Get('item_org_id'),'The org_id should be the one of the contact');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user