Merge remote-tracking branch 'origin/support/2.7' into support/3.0

# Conflicts:
#	test/core/DBObjectTest.php
This commit is contained in:
Molkobain
2022-03-23 09:44:13 +01:00

View File

@@ -28,6 +28,7 @@ namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use DBObject;
use MetaModel;
/**
@@ -94,6 +95,39 @@ class DBObjectTest extends ItopDataTestCase
static::assertNull($oObject->GetOriginal('sla_tto_passed'));
}
/**
* @return void
* @throws \Exception
*/
public function testListPreviousValuesForUpdatedAttributes()
{
$oOrg = $this->CreateOrganization('testListPreviousValuesForUpdatedAttributes');
$this->assertCount(0, $oOrg->ListChanges());
$oOrg->Set('code', strtoupper('testListPreviousValuesForUpdatedAttributes'));
$this->assertCount(1, $oOrg->ListChanges());
$oOrg->DBUpdate();
$this->assertCount(0, $oOrg->ListChanges());
$this->assertCount(1, $oOrg->ListPreviousValuesForUpdatedAttributes());
$oOrg->DBUpdate();
$this->assertCount(0, $oOrg->ListChanges());
$this->assertCount(1, $oOrg->ListPreviousValuesForUpdatedAttributes());
$oOrg->DBDelete();
$oOrg = MetaModel::NewObject('Organization');
$oOrg->Set('name', 'testListPreviousValuesForUpdatedAttributes');
$oOrg->DBInsert();
$oOrg->Set('code', strtoupper('testListPreviousValuesForUpdatedAttributes'));
$oOrg->DBUpdate();
$oOrg->DBUpdate();
$this->markTestIncomplete('This test has not been implemented yet. wait for N°4967 fix');
$this->debug("ERROR: N°4967 - 'Previous Values For Updated Attributes' not updated if DBUpdate is called without modifying the object");
//$this->assertCount(0, $oOrg->ListPreviousValuesForUpdatedAttributes());
}
/**
* @covers DBObject::NewObject
* @covers DBObject::Get