Skip to content

Commit

Permalink
fix tests and enhance cache clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Dec 3, 2024
1 parent cda2d12 commit 05fb467
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions phpunit/GLPITestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

use Glpi\Asset\AssetDefinitionManager;
use Glpi\Dropdown\DropdownDefinitionManager;
use Glpi\Tests\Log\TestHandler;
use Monolog\Level;
use Monolog\Logger;
Expand Down Expand Up @@ -87,6 +88,9 @@ public function setUp(): void
$SQLLOGGER->setHandlers([$this->sql_log_handler]);

vfsStreamWrapper::register();

AssetDefinitionManager::getInstance()->registerAutoload();
DropdownDefinitionManager::getInstance()->registerAutoload();
}

public function tearDown(): void
Expand Down
3 changes: 2 additions & 1 deletion src/Glpi/CustomObject/AbstractDefinitionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ final public function getDefinition(string $system_name): ?AbstractDefinition
*/
final public function clearDefinitionsCache(): void
{
$this->definitions_data = [];
$definition_class = static::getDefinitionClass();
unset($this->definitions_data[$definition_class]);
}

/**
Expand Down

0 comments on commit 05fb467

Please sign in to comment.