mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
DBObject->GetOriginal() hardening (now support attributes not set: for example sla_tto_passed for UserRequest until it is closed)
SVN:trunk[5932]
This commit is contained in:
@@ -112,6 +112,26 @@ class ItopDataTestCase extends ItopTestCase
|
||||
return $oMyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param $iKey
|
||||
* @param array $aParams
|
||||
*
|
||||
* @return DBObject
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
*/
|
||||
protected static function updateObject($sClass, $iKey, $aParams)
|
||||
{
|
||||
$oMyObj = MetaModel::GetObject($sClass, $iKey);
|
||||
foreach($aParams as $sAttCode => $oValue)
|
||||
{
|
||||
$oMyObj->Set($sAttCode, $oValue);
|
||||
}
|
||||
$oMyObj->DBUpdate();
|
||||
return $oMyObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Organization in database
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Core;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use DBObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ use PHPUnit\Framework\TestCase;
|
||||
* @preserveGlobalState disabled
|
||||
* @backupGlobals disabled
|
||||
*/
|
||||
class DBObjectTest extends ItopTestCase
|
||||
class DBObjectTest extends ItopDataTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
@@ -50,7 +49,7 @@ class DBObjectTest extends ItopTestCase
|
||||
*/
|
||||
public function testGetUIPage()
|
||||
{
|
||||
$this->assertEquals('UI.php', DBObject::GetUIPage());
|
||||
static::assertEquals('UI.php', DBObject::GetUIPage());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +60,7 @@ class DBObjectTest extends ItopTestCase
|
||||
*/
|
||||
public function testIsValidPKeyOK($key, $res)
|
||||
{
|
||||
$this->assertEquals(DBObject::IsValidPKey($key), $res);
|
||||
static::assertEquals(DBObject::IsValidPKey($key), $res);
|
||||
}
|
||||
|
||||
public function keyProviderOK()
|
||||
@@ -80,4 +79,11 @@ class DBObjectTest extends ItopTestCase
|
||||
array('PHP_INT_MIN', false));
|
||||
}
|
||||
|
||||
public function testGetOriginal()
|
||||
{
|
||||
$oObject = $this->CreateUserRequest(190664);
|
||||
|
||||
static::assertNull($oObject->GetOriginal('sla_tto_passed'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user