From 1c33eaf310b9a84b646784f14fd15adf39d537b1 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:04:49 +0200 Subject: [PATCH 1/6] Fix CI --- tests/QuestionTypeTestCase.php | 5 +++-- tests/Units/ContainerTest.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/QuestionTypeTestCase.php b/tests/QuestionTypeTestCase.php index a4145911..1aaba5a5 100644 --- a/tests/QuestionTypeTestCase.php +++ b/tests/QuestionTypeTestCase.php @@ -34,6 +34,7 @@ use Glpi\Form\Form; use Glpi\Tests\DbTestCase; use Glpi\Tests\FormTesterTrait; +use Glpi\Tests\GLPITestCase; use PluginFieldsContainer; use PluginFieldsField; use ReflectionClass; @@ -82,13 +83,13 @@ public function createFieldAndContainer(): void public function setUp(): void { $this->createFieldAndContainer(); - parent::setUp(); + GLPITestCase::setUp(); } public function tearDown(): void { $this->tearDownFieldTest(); - parent::tearDown(); + GLPITestCase::tearDown(); } protected function renderFormEditor(Form $form): Crawler diff --git a/tests/Units/ContainerTest.php b/tests/Units/ContainerTest.php index 384969c8..a7fa7098 100644 --- a/tests/Units/ContainerTest.php +++ b/tests/Units/ContainerTest.php @@ -32,6 +32,7 @@ use Computer; use Glpi\Tests\DbTestCase; +use Glpi\Tests\GLPITestCase; use GlpiPlugin\Field\Tests\FieldTestTrait; use PHPUnit\Framework\Attributes\DataProvider; use PluginFieldsContainer; @@ -44,14 +45,14 @@ final class ContainerTest extends DbTestCase public function setUp(): void { - parent::setUp(); + GLPITestCase::setUp(); $this->login(); } public function tearDown(): void { $this->tearDownFieldTest(); - parent::tearDown(); + GLPITestCase::tearDown(); } public static function provideInvalidItemtypes(): iterable From 3b6a25ddb101d5194604c76ec2e0f73291159e16 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:05:06 +0200 Subject: [PATCH 2/6] adapt changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fc044fe..f81f8269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [unreleased] + + ## [1.24.2] - 2026-06-30 ### Fixed From f22d0c0f8c2269c4daa14325ae352680f2216313 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:11:34 +0200 Subject: [PATCH 3/6] fix --- tests/Units/ContainerItemUpdateTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/Units/ContainerItemUpdateTest.php b/tests/Units/ContainerItemUpdateTest.php index 6625580d..3cb74899 100644 --- a/tests/Units/ContainerItemUpdateTest.php +++ b/tests/Units/ContainerItemUpdateTest.php @@ -58,12 +58,20 @@ final class ContainerItemUpdateTest extends DbTestCase { use FieldTestTrait; + public function setUp(): void + { + GLPITestCase::setUp(); + } + public function tearDown(): void { - $this->tearDownFieldTest(); - parent::tearDown(); + global $DB; + $DB->setMustUnsanitizeData(false); // Be sure to switch back to disabled unsanitization. + + GLPITestCase::tearDown(); } + // ----------------------------------------------------------------------- // Helpers // ----------------------------------------------------------------------- From eea39ca31d3ca6d72da6c5c6d8dc14c31b0bac7b Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:57:05 +0200 Subject: [PATCH 4/6] fix --- tests/Units/ContainerItemUpdateTest.php | 9 +++++++++ tests/Units/FieldDestinationFieldTest.php | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/Units/ContainerItemUpdateTest.php b/tests/Units/ContainerItemUpdateTest.php index 3cb74899..e8cdac7b 100644 --- a/tests/Units/ContainerItemUpdateTest.php +++ b/tests/Units/ContainerItemUpdateTest.php @@ -31,6 +31,7 @@ namespace GlpiPlugin\Field\Tests\Units; use Glpi\Tests\DbTestCase; +use Glpi\Tests\GLPITestCase; use GlpiPlugin\Field\Tests\FieldTestTrait; use PluginFieldsContainer; use Ticket; @@ -60,6 +61,7 @@ final class ContainerItemUpdateTest extends DbTestCase public function setUp(): void { + GLPITestCase::setUp(); } @@ -68,6 +70,10 @@ public function tearDown(): void global $DB; $DB->setMustUnsanitizeData(false); // Be sure to switch back to disabled unsanitization. + $container = new PluginFieldsContainer(); + foreach ($container->find() as $container_fields) { + $container->delete($container_fields, true); + } GLPITestCase::tearDown(); } @@ -660,6 +666,9 @@ public function testOnlyOneDomContainerAllowedPerItemtype(): void ]); $this->assertFalse((bool) $result, 'Creating a second DOM container for the same itemtype must be rejected.'); + + // message should be checked manually + $this->hasSessionMessages(ERROR, ['You cannot add several blocks with type \'Insertion in the form\' on same object']); } // ----------------------------------------------------------------------- diff --git a/tests/Units/FieldDestinationFieldTest.php b/tests/Units/FieldDestinationFieldTest.php index 6804baed..d4b81f4b 100644 --- a/tests/Units/FieldDestinationFieldTest.php +++ b/tests/Units/FieldDestinationFieldTest.php @@ -39,6 +39,7 @@ use Glpi\Tests\AbstractDestinationFieldTest; use Glpi\Tests\FormBuilder; use Glpi\Tests\FormTesterTrait; +use Glpi\Tests\GLPITestCase; use GlpiPlugin\Field\Tests\FieldTestTrait; use Group; use Location; @@ -63,6 +64,10 @@ final class FieldDestinationFieldTest extends AbstractDestinationFieldTest private function initFieldTest(): void { + $container = new PluginFieldsContainer(); + foreach ($container->find() as $container_fields) { + $container->delete($container_fields, true); + } $this->blocks[Ticket::class] = $this->createFieldContainer([ 'label' => 'Ticket additional fields', 'type' => 'dom', @@ -125,12 +130,12 @@ private function initFieldTest(): void public function setUp(): void { $this->initFieldTest(); - parent::setUp(); + GLPITestCase::setUp(); } public function tearDown(): void { - parent::tearDown(); + GLPITestCase::tearDown(); $this->tearDownFieldTest(); } @@ -238,6 +243,9 @@ public function testDestinationWithLocationAdditonalFields(): void ], ], ); + + // delete location for another run + $location->delete($location->fields, true); } #[Override] From 8772aa1fcb4e239d969193c4b26f26b7b8a73974 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:57:56 +0200 Subject: [PATCH 5/6] fix ci --- tests/Units/ContainerItemUpdateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Units/ContainerItemUpdateTest.php b/tests/Units/ContainerItemUpdateTest.php index e8cdac7b..483a859f 100644 --- a/tests/Units/ContainerItemUpdateTest.php +++ b/tests/Units/ContainerItemUpdateTest.php @@ -61,7 +61,6 @@ final class ContainerItemUpdateTest extends DbTestCase public function setUp(): void { - GLPITestCase::setUp(); } @@ -74,6 +73,7 @@ public function tearDown(): void foreach ($container->find() as $container_fields) { $container->delete($container_fields, true); } + GLPITestCase::tearDown(); } From ef9f2b3bef17d091bd04543db2fc0c125187af1e Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 17:02:32 +0200 Subject: [PATCH 6/6] fix CS --- tests/Units/ContainerItemUpdateTest.php | 2 +- tests/Units/FieldDestinationFieldTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Units/ContainerItemUpdateTest.php b/tests/Units/ContainerItemUpdateTest.php index 483a859f..f8474a7c 100644 --- a/tests/Units/ContainerItemUpdateTest.php +++ b/tests/Units/ContainerItemUpdateTest.php @@ -668,7 +668,7 @@ public function testOnlyOneDomContainerAllowedPerItemtype(): void $this->assertFalse((bool) $result, 'Creating a second DOM container for the same itemtype must be rejected.'); // message should be checked manually - $this->hasSessionMessages(ERROR, ['You cannot add several blocks with type \'Insertion in the form\' on same object']); + $this->hasSessionMessages(ERROR, ["You cannot add several blocks with type 'Insertion in the form' on same object"]); } // ----------------------------------------------------------------------- diff --git a/tests/Units/FieldDestinationFieldTest.php b/tests/Units/FieldDestinationFieldTest.php index d4b81f4b..316169a8 100644 --- a/tests/Units/FieldDestinationFieldTest.php +++ b/tests/Units/FieldDestinationFieldTest.php @@ -68,6 +68,7 @@ private function initFieldTest(): void foreach ($container->find() as $container_fields) { $container->delete($container_fields, true); } + $this->blocks[Ticket::class] = $this->createFieldContainer([ 'label' => 'Ticket additional fields', 'type' => 'dom',