mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
N°6275 - Denis feedbacks
This commit is contained in:
@@ -2251,13 +2251,10 @@ interface iModuleExtension
|
||||
* Interface to manipulate ormCaseLog objects after initialization/edition
|
||||
*
|
||||
* @api
|
||||
* @private
|
||||
* @since 3.1.0 N°6275
|
||||
*/
|
||||
interface iOrmCaseLogExtension
|
||||
{
|
||||
public function __construct();
|
||||
|
||||
/**
|
||||
* Rebuild API to be able manipulate ormCaseLog after its initialization/modifications
|
||||
* Examples of use: fix ormcase log broken index/shrink huge histories/....
|
||||
@@ -2268,3 +2265,17 @@ interface iOrmCaseLogExtension
|
||||
*/
|
||||
public function Rebuild(&$sLog, &$aIndex) : bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from iOrmCaseLogExtension to manipulate ormCaseLog after its initialization/modifications
|
||||
*
|
||||
* @api
|
||||
* @since 3.1.0 N°6275
|
||||
*/
|
||||
abstract class AbstractOrmCaseLogExtension implements iOrmCaseLogExtension
|
||||
{
|
||||
public function Rebuild(&$sLog, &$aIndex) : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,6 +757,7 @@ class ormCaseLog {
|
||||
if (! is_null($oNewOrmCaseLog)) {
|
||||
$this->m_aIndex = $oNewOrmCaseLog->m_aIndex;
|
||||
$this->m_sLog = $oNewOrmCaseLog->m_sLog;
|
||||
$this->m_bModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,21 @@ class ormCaseLogTest extends ItopDataTestCase
|
||||
$aInitialIndex = ['a' => 'b'];
|
||||
$aRebuiltIndex = ['c' => 'd'];
|
||||
|
||||
/*$aOrmCaseLogExtensionForTest = $this->createMock(\iOrmCaseLogExtension::class);
|
||||
$aOrmCaseLogExtensionForTest->expects($this->exactly(1))
|
||||
->method('Rebuild')
|
||||
->with(
|
||||
$this->callback(
|
||||
function ($sLogParam, &$aIndexParam) use ($aInitialIndex, $sLog, $aRebuiltIndex, $sRebuiltLog, $bTouched) {
|
||||
$sLogParam = $sRebuiltLog;
|
||||
$aIndexParam = $aRebuiltIndex;
|
||||
return ($sLog === $sLogParam)
|
||||
&& ($aInitialIndex === $sLogParam);
|
||||
}
|
||||
)
|
||||
)
|
||||
->willReturn($bTouched);*/
|
||||
|
||||
$aOrmCaseLogExtensionForTest = new \OrmCaseLogExtensionForTest();
|
||||
$aOrmCaseLogExtensionForTest->Init($bTouched, $sRebuiltLog, $aRebuiltIndex);
|
||||
$aOrmCaseLogExtension=[$aOrmCaseLogExtensionForTest];
|
||||
|
||||
Reference in New Issue
Block a user