mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-24 12:54:11 +01:00
Compare commits
5 Commits
3.1.0-3
...
support/3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fb5c05467 | ||
|
|
f36f3aa05b | ||
|
|
d0d90d7c69 | ||
|
|
239c51bb53 | ||
|
|
bdf0b4daa9 |
@@ -59,9 +59,17 @@ class DbConnectionWrapper
|
||||
* Use this to register a mock that will handle {@see mysqli::query()}
|
||||
*
|
||||
* @param \mysqli|null $oMysqli
|
||||
* @since 3.0.4 3.1.1 3.2.0 Param $oMysqli becomes nullable
|
||||
* @since 3.1.0-4 N°6848 backport of restoring cnx on null parameter value
|
||||
*/
|
||||
public static function SetDbConnectionMockForQuery(?mysqli $oMysqli): void
|
||||
public static function SetDbConnectionMockForQuery(?mysqli $oMysqli = null): void
|
||||
{
|
||||
static::$oDbCnxMockableForQuery = $oMysqli;
|
||||
if (is_null($oMysqli)) {
|
||||
// Reset to standard connection
|
||||
static::$oDbCnxMockableForQuery = static::$oDbCnxStandard;
|
||||
}
|
||||
else {
|
||||
static::$oDbCnxMockableForQuery = $oMysqli;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,5 @@ IssueLog::Trace('----- Request: '.utils::GetRequestUri(), LogChannels::WEB_REQUE
|
||||
$sTemplates = APPROOT.'templates/pages/backoffice/oauth';
|
||||
|
||||
$oUpdateController = new OAuthLandingController($sTemplates, 'core');
|
||||
$oUpdateController->AllowOnlyAdmin();
|
||||
$oUpdateController->SetDefaultOperation('Landing');
|
||||
$oUpdateController->HandleOperation();
|
||||
|
||||
@@ -892,7 +892,10 @@ class iTopDesignFormat
|
||||
$oNodeList = $oXPath->query("/itop_design/classes//class/fields/field/values/value");
|
||||
foreach ($oNodeList as $oNode) {
|
||||
$sCode = $oNode->textContent;
|
||||
$oNode->textContent = '';
|
||||
// N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545
|
||||
// $oNode->textContent = '';
|
||||
// N°6562 to update text node content we must use the node methods !
|
||||
$oNode->removeChild($oNode->firstChild);
|
||||
$oCodeNode = $oNode->ownerDocument->createElement("code", $sCode);
|
||||
$oNode->appendChild($oCodeNode);
|
||||
}
|
||||
@@ -982,7 +985,12 @@ class iTopDesignFormat
|
||||
if ($oStyleNode) {
|
||||
$this->DeleteNode($oStyleNode);
|
||||
}
|
||||
$oNode->textContent = $sCode;
|
||||
|
||||
// N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545
|
||||
// $oNode->textContent = $sCode;
|
||||
// N°6562 to update text node content we must use the node methods !
|
||||
$oTextContentNode = new DOMText($sCode);
|
||||
$oNode->appendChild($oTextContentNode);
|
||||
}
|
||||
}
|
||||
// - Style
|
||||
|
||||
@@ -136,6 +136,8 @@ class ItopDataTestCase extends ItopTestCase
|
||||
}
|
||||
}
|
||||
|
||||
CMDBObject::SetCurrentChange(null);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@ class ItopTestCase extends TestCase
|
||||
|
||||
if (CMDBSource::IsInsideTransaction()) {
|
||||
// Nested transactions were opened but not finished !
|
||||
// Rollback to avoid side effects on next tests
|
||||
while (CMDBSource::IsInsideTransaction()) {
|
||||
CMDBSource::Query('ROLLBACK');
|
||||
}
|
||||
throw new MySQLTransactionNotClosedException('Some DB transactions were opened but not closed ! Fix the code by adding ROLLBACK or COMMIT statements !', []);
|
||||
}
|
||||
}
|
||||
@@ -312,4 +316,4 @@ class ItopTestCase extends TestCase
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +276,7 @@ class TransactionsTest extends ItopTestCase
|
||||
protected function tearDown(): void
|
||||
{
|
||||
try {
|
||||
DbConnectionWrapper::SetDbConnectionMockForQuery(); // Else will throw error on PHP 8.1+ (see N°6848)
|
||||
parent::tearDown();
|
||||
}
|
||||
catch (MySQLTransactionNotClosedException $e) {
|
||||
|
||||
Reference in New Issue
Block a user