diff --git a/CHANGELOG.md b/CHANGELOG.md
index af716fe..8b2bd99 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@ 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.2.0] - 2026-07-28
### Add
diff --git a/advancedforms.xml b/advancedforms.xml
index d070c26..5696eca 100644
--- a/advancedforms.xml
+++ b/advancedforms.xml
@@ -25,6 +25,11 @@
Teclib'
+
+ 1.2.0
+ ~11.0.0
+ https://github.com/pluginsGLPI/advancedforms/releases/download/1.2.0/glpi-advancedforms-1.2.0.tar.bz2
+
1.1.1
~11.0.0
diff --git a/rector.php b/rector.php
index 632ef48..9d8dcf7 100644
--- a/rector.php
+++ b/rector.php
@@ -31,28 +31,26 @@
* -------------------------------------------------------------------------
*/
+use Rector\Configuration\RectorConfigBuilder;
+
require_once __DIR__ . '/../../src/Plugin.php';
-use Rector\Caching\ValueObject\Storage\FileCacheStorage;
-use Rector\Config\RectorConfig;
-use Rector\ValueObject\PhpVersion;
+$baseline_file = __DIR__ . '/../../PluginsRector.php';
+if (!file_exists($baseline_file)) {
+ throw new RuntimeException(
+ sprintf(
+ 'Unable to find "%s". Running rector on a plugin requires a GLPI development checkout that ships PluginsRector.php.',
+ $baseline_file,
+ ),
+ );
+}
+
+$baseline = require $baseline_file;
+
+/** @var RectorConfigBuilder $config */
+$config = $baseline([
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+]);
-return RectorConfig::configure()
- ->withPaths([
- __DIR__ . '/src',
- ])
- ->withPhpVersion(PhpVersion::PHP_82)
- ->withCache(
- cacheDirectory: __DIR__ . '/var/rector',
- cacheClass: FileCacheStorage::class,
- )
- ->withRootFiles()
- ->withParallel(timeoutSeconds: 300)
- ->withImportNames(removeUnusedImports: true)
- ->withPreparedSets(
- deadCode: true,
- codeQuality: true,
- codingStyle: true,
- )
- ->withPhpSets(php82: true) // apply PHP sets up to PHP 8.2
-;
+return $config;
diff --git a/setup.php b/setup.php
index c6c63cb..5d2bd7f 100644
--- a/setup.php
+++ b/setup.php
@@ -36,7 +36,7 @@
use GlpiPlugin\Advancedforms\Service\InitManager;
/** @phpstan-ignore theCodingMachineSafe.function (safe to assume this isn't already defined) */
-define('PLUGIN_ADVANCEDFORMS_VERSION', '1.1.1');
+define('PLUGIN_ADVANCEDFORMS_VERSION', '1.2.0');
// Minimal GLPI version, inclusive
/** @phpstan-ignore theCodingMachineSafe.function (safe to assume this isn't already defined) */
diff --git a/tests/AdvancedFormsTestCase.php b/tests/AdvancedFormsTestCase.php
index 8e1bbb2..ecf9c4f 100644
--- a/tests/AdvancedFormsTestCase.php
+++ b/tests/AdvancedFormsTestCase.php
@@ -72,11 +72,6 @@ public function setUp(): void
]);
}
- public function tearDown(): void
- {
- parent::tearDown();
- }
-
protected function enableConfigurableItem(
ConfigurableItemInterface|string $item,
): void {
@@ -91,6 +86,7 @@ protected function enableConfigurableItems(
foreach ($items as $item) {
$this->setConfigurableItemConfig($item, true);
}
+
InitManager::getInstance()->init();
}
@@ -108,6 +104,7 @@ protected function disableConfigurableItems(
foreach ($items as $item) {
$this->setConfigurableItemConfig($item, false);
}
+
InitManager::getInstance()->init();
}
@@ -169,6 +166,7 @@ private function deleteSingletonInstance(array $classes)
$reflection_property = $reflection_class->getProperty('instance');
$reflection_property->setValue(null, null);
}
+
if ($reflection_class->hasProperty('_instances')) {
$reflection_property = $reflection_class->getProperty('_instances');
$reflection_property->setValue(null, []);
diff --git a/tests/Front/FrontTestCase.php b/tests/Front/FrontTestCase.php
index 3c8fd49..19dec0c 100644
--- a/tests/Front/FrontTestCase.php
+++ b/tests/Front/FrontTestCase.php
@@ -55,10 +55,10 @@ public function get(string $url, array $params = []): Crawler
$_SERVER['REQUEST_URI'] = GLPI_ROOT . $url;
require(GLPI_ROOT . $url);
$html = ob_get_clean();
- } catch (Throwable $e) {
+ } catch (Throwable $throwable) {
$_GET = $old_GET;
ob_get_clean();
- throw $e;
+ throw $throwable;
} finally {
$_GET = $old_GET;
}
@@ -129,17 +129,20 @@ public function sendForm(
if (count($submits) > 1) {
throw new RuntimeException("Only forms with a single submit are supported");
}
+
$submit = $submits->getNode(0);
if (!$submit instanceof DOMElement) {
throw new LogicException(); // Impossible
}
+
$payload[$submit->getAttribute('name')] = $submit->getAttribute('value');
// Insert specified payload values
foreach ($form_values as $key => $value) {
if (!isset($payload[$key])) {
- throw new RuntimeException("Input '$key' does not exist");
+ throw new RuntimeException(sprintf("Input '%s' does not exist", $key));
}
+
$payload[$key] = $value;
}
diff --git a/tests/Helpers/NetworkHelperTest.php b/tests/Helpers/NetworkHelperTest.php
index 9f65eae..276c6f1 100644
--- a/tests/Helpers/NetworkHelperTest.php
+++ b/tests/Helpers/NetworkHelperTest.php
@@ -33,13 +33,14 @@
namespace GlpiPlugin\Advancedforms\Tests\Helpers;
+use Generator;
use GlpiPlugin\Advancedforms\Helpers\NetworkHelper;
use GlpiPlugin\Advancedforms\Tests\AdvancedFormsTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
final class NetworkHelperTest extends AdvancedFormsTestCase
{
- public static function getRemoteIpAddressProvider(): \Generator
+ public static function getRemoteIpAddressProvider(): Generator
{
// Test X-Forwarded-For header with single IP (highest priority)
yield 'X-Forwarded-For with single IP' => [
@@ -126,13 +127,13 @@ public function testGetIPAddress(
// Setup environment
if ($http_x_forwarded_for !== '') {
- putenv("HTTP_X_FORWARDED_FOR={$http_x_forwarded_for}");
+ putenv('HTTP_X_FORWARDED_FOR=' . $http_x_forwarded_for);
} else {
putenv("HTTP_X_FORWARDED_FOR=");
}
if ($remote_addr_env !== '') {
- putenv("REMOTE_ADDR={$remote_addr_env}");
+ putenv('REMOTE_ADDR=' . $remote_addr_env);
} else {
putenv("REMOTE_ADDR=");
}
diff --git a/tests/Model/Mapper/FormcreatorHiddenTypeMapperTest.php b/tests/Model/Mapper/FormcreatorHiddenTypeMapperTest.php
index 41faa21..e0247a2 100644
--- a/tests/Model/Mapper/FormcreatorHiddenTypeMapperTest.php
+++ b/tests/Model/Mapper/FormcreatorHiddenTypeMapperTest.php
@@ -33,6 +33,7 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\Mapper;
+use DBmysql;
use Glpi\Form\AccessControl\FormAccessControlManager;
use Glpi\Form\Migration\FormMigration;
use Glpi\Form\Question;
@@ -43,7 +44,7 @@ final class FormcreatorHiddenTypeMapperTest extends MapperTestCase
{
public function testHiddenTypeMigrationWhenEnabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: enable ip question type and add some fomrcreator data
@@ -81,7 +82,7 @@ public function testHiddenTypeMigrationWhenEnabled(): void
public function testHiddenTypeMigrationWhenDisabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: add some fomrcreator data
diff --git a/tests/Model/Mapper/FormcreatorHostnameTypeMapperTest.php b/tests/Model/Mapper/FormcreatorHostnameTypeMapperTest.php
index e046c2c..423ca1a 100644
--- a/tests/Model/Mapper/FormcreatorHostnameTypeMapperTest.php
+++ b/tests/Model/Mapper/FormcreatorHostnameTypeMapperTest.php
@@ -33,6 +33,7 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\Mapper;
+use DBmysql;
use Glpi\Form\AccessControl\FormAccessControlManager;
use Glpi\Form\Migration\FormMigration;
use Glpi\Form\Question;
@@ -43,7 +44,7 @@ final class FormcreatorHostnameTypeMapperTest extends MapperTestCase
{
public function testHostnameTypeMigrationWhenEnabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: enable ip question type and add some fomrcreator data
@@ -71,7 +72,7 @@ public function testHostnameTypeMigrationWhenEnabled(): void
public function testHostnameTypeMigrationWhenDisabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: add some fomrcreator data
diff --git a/tests/Model/Mapper/FormcreatorIpTypeMapperTest.php b/tests/Model/Mapper/FormcreatorIpTypeMapperTest.php
index b8685be..92b3441 100644
--- a/tests/Model/Mapper/FormcreatorIpTypeMapperTest.php
+++ b/tests/Model/Mapper/FormcreatorIpTypeMapperTest.php
@@ -33,6 +33,7 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\Mapper;
+use DBmysql;
use Glpi\Form\AccessControl\FormAccessControlManager;
use Glpi\Form\Migration\FormMigration;
use Glpi\Form\Question;
@@ -43,7 +44,7 @@ final class FormcreatorIpTypeMapperTest extends MapperTestCase
{
public function testIpTypeMigrationWhenEnabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: enable ip question type and add some fomrcreator data
@@ -71,7 +72,7 @@ public function testIpTypeMigrationWhenEnabled(): void
public function testIpTypeMigrationWhenDisabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: add some fomrcreator data
diff --git a/tests/Model/Mapper/FormcreatorLdapSelectTypeMapperTest.php b/tests/Model/Mapper/FormcreatorLdapSelectTypeMapperTest.php
index a14420d..de122d3 100644
--- a/tests/Model/Mapper/FormcreatorLdapSelectTypeMapperTest.php
+++ b/tests/Model/Mapper/FormcreatorLdapSelectTypeMapperTest.php
@@ -33,6 +33,7 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\Mapper;
+use DBmysql;
use AuthLDAP;
use Glpi\Form\AccessControl\FormAccessControlManager;
use Glpi\Form\Migration\FormMigration;
@@ -46,7 +47,7 @@ final class FormcreatorLdapSelectTypeMapperTest extends MapperTestCase
{
public function testLdapSelectTypeMigrationWhenEnabledWithValidAuthLDAP(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: create a valid AuthLDAP
@@ -73,7 +74,7 @@ public function testLdapSelectTypeMigrationWhenEnabledWithInvalidAuthLDAP(): voi
private function testLdapSelectTypeMigrationWhenEnabled(int $authldap_id, ?int $expected_authldap_id): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: enable ldap select question type and add some formcreator data
@@ -107,6 +108,7 @@ private function testLdapSelectTypeMigrationWhenEnabled(int $authldap_id, ?int $
if (!$config instanceof LdapQuestionConfig) {
throw new LogicException();
}
+
$this->assertEquals($expected_authldap_id ?? $authldap_id, $config->getAuthLdapId());
$this->assertEquals(456, $config->getLdapAttributeId());
$this->assertEquals(
@@ -117,7 +119,7 @@ private function testLdapSelectTypeMigrationWhenEnabled(int $authldap_id, ?int $
public function testLdapSelectTypeMigrationWhenDisabled(): void
{
- /** @var \DBmysql $DB */
+ /** @var DBmysql $DB */
global $DB;
// Arrange: add some formcreator data
diff --git a/tests/Model/QuestionType/QuestionTypeTestCase.php b/tests/Model/QuestionType/QuestionTypeTestCase.php
index 50a802a..dab0d70 100644
--- a/tests/Model/QuestionType/QuestionTypeTestCase.php
+++ b/tests/Model/QuestionType/QuestionTypeTestCase.php
@@ -86,6 +86,7 @@ final public function testQuestionIsAvailableInTypeDropdownWhenEnabled(): void
$builder = new FormBuilder("My form");
$builder->addQuestion("My question", QuestionTypeShortText::class);
+
$form = $this->createForm($builder);
// Act: render form editor
@@ -108,6 +109,7 @@ final public function testQuestionIsNotAvailableInTypeDropdownWhenDisabled(): vo
// Arrange: create a form
$builder = new FormBuilder("My form");
$builder->addQuestion("My question", QuestionTypeShortText::class);
+
$form = $this->createForm($builder);
// Act: render form editor
diff --git a/tests/Model/QuestionType/TableQuestionConfigTest.php b/tests/Model/QuestionType/TableQuestionConfigTest.php
index 64b85a3..76c2ed7 100644
--- a/tests/Model/QuestionType/TableQuestionConfigTest.php
+++ b/tests/Model/QuestionType/TableQuestionConfigTest.php
@@ -33,6 +33,8 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\QuestionType;
+use Glpi\Form\QuestionType\QuestionTypeShortText;
+use Glpi\Form\QuestionType\QuestionTypeNumber;
use GlpiPlugin\Advancedforms\Model\QuestionType\TableQuestionConfig;
use GlpiPlugin\Advancedforms\Tests\AdvancedFormsTestCase;
@@ -50,8 +52,8 @@ public function testJsonRoundtrip(): void
{
$original = new TableQuestionConfig(
columns: [
- ['name' => 'Source IP', 'question_type' => 'Glpi\\Form\\QuestionType\\QuestionTypeShortText', 'required' => true, 'itemtype' => '', 'pattern' => '/^172\\.23\\./'],
- ['name' => 'Port', 'question_type' => 'Glpi\\Form\\QuestionType\\QuestionTypeNumber', 'required' => false, 'itemtype' => '', 'pattern' => ''],
+ ['name' => 'Source IP', 'question_type' => QuestionTypeShortText::class, 'required' => true, 'itemtype' => '', 'pattern' => '/^172\\.23\\./'],
+ ['name' => 'Port', 'question_type' => QuestionTypeNumber::class, 'required' => false, 'itemtype' => '', 'pattern' => ''],
],
min_rows: 2,
max_rows: 20,
@@ -67,7 +69,7 @@ public function testColumnPatternDefaultsToEmptyStringWhenAbsent(): void
{
$config = TableQuestionConfig::jsonDeserialize([
'columns' => [
- ['name' => 'Source IP', 'question_type' => 'Glpi\\Form\\QuestionType\\QuestionTypeShortText', 'required' => true],
+ ['name' => 'Source IP', 'question_type' => QuestionTypeShortText::class, 'required' => true],
],
]);
diff --git a/tests/Model/QuestionType/TableQuestionIntegrationTest.php b/tests/Model/QuestionType/TableQuestionIntegrationTest.php
index 151f88b..e168046 100644
--- a/tests/Model/QuestionType/TableQuestionIntegrationTest.php
+++ b/tests/Model/QuestionType/TableQuestionIntegrationTest.php
@@ -52,7 +52,7 @@ protected function getTestedQuestionType(): QuestionTypeInterface&ConfigurableIt
}
#[Override]
- protected function getDefaultExtraDataForQuestionType(QuestionTypeInterface $type): ?string
+ protected function getDefaultExtraDataForQuestionType(QuestionTypeInterface $type): string
{
return json_encode(new TableQuestionConfig(
columns: [
diff --git a/tests/Model/QuestionType/TableQuestionValidationTest.php b/tests/Model/QuestionType/TableQuestionValidationTest.php
index 042efdc..c70f2e9 100644
--- a/tests/Model/QuestionType/TableQuestionValidationTest.php
+++ b/tests/Model/QuestionType/TableQuestionValidationTest.php
@@ -172,7 +172,7 @@ public function testRequiredValidationCoversEveryCompatibleColumnType(): void
$this->assertFalse(
$result->isValid(),
- "Required validation should fail for column type {$fqcn}",
+ 'Required validation should fail for column type ' . $fqcn,
);
}
}
diff --git a/tests/Model/QuestionType/TreeCascadeDropdownQuestionTest.php b/tests/Model/QuestionType/TreeCascadeDropdownQuestionTest.php
index 295236c..ad66194 100644
--- a/tests/Model/QuestionType/TreeCascadeDropdownQuestionTest.php
+++ b/tests/Model/QuestionType/TreeCascadeDropdownQuestionTest.php
@@ -33,6 +33,20 @@
namespace GlpiPlugin\Advancedforms\Tests\Model\QuestionType;
+use State;
+use ITILCategory;
+use TaskCategory;
+use Glpi\Form\Category;
+use SoftwareLicenseType;
+use DocumentCategory;
+use BusinessCriticity;
+use KnowbaseItemCategory;
+use IPNetwork;
+use SoftwareCategory;
+use WebhookCategory;
+use Dropdown;
+use Glpi\Form\Form;
+use Glpi\Controller\Form\RendererController;
use Glpi\Form\QuestionType\QuestionTypeInterface;
use Glpi\Form\QuestionType\QuestionTypeItemDropdownExtraDataConfig;
use Glpi\Tests\FormBuilder;
@@ -84,7 +98,7 @@ protected function validateHelpdeskRenderingWhenDisabled(
#[Override]
protected function getDefaultExtraDataForQuestionType(
QuestionTypeInterface $type,
- ): ?string {
+ ): string {
return json_encode(new QuestionTypeItemDropdownExtraDataConfig(
itemtype: Location::class,
));
@@ -125,31 +139,31 @@ public function testAllowedItemtypes(): void
$expected = [
'Common' => [
Location::class,
- \State::class,
+ State::class,
],
'Assistance' => [
- \ITILCategory::class,
- \TaskCategory::class,
- \Glpi\Form\Category::class,
+ ITILCategory::class,
+ TaskCategory::class,
+ Category::class,
],
'Types' => [
- \SoftwareLicenseType::class,
+ SoftwareLicenseType::class,
],
'Management' => [
- \DocumentCategory::class,
- \BusinessCriticity::class,
+ DocumentCategory::class,
+ BusinessCriticity::class,
],
'Tools' => [
- \KnowbaseItemCategory::class,
+ KnowbaseItemCategory::class,
],
'Internet' => [
- \IPNetwork::class,
+ IPNetwork::class,
],
'Software' => [
- \SoftwareCategory::class,
+ SoftwareCategory::class,
],
'Others' => [
- \WebhookCategory::class,
+ WebhookCategory::class,
],
];
$question_type = new TreeCascadeDropdownQuestion();
@@ -200,7 +214,7 @@ public function testHelpdeskRenderingWithLocationHierarchy(): void
'entities_id' => $entity_id,
]);
- $grandchild = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Grandchild Location',
'locations_id' => $child->getID(),
'entities_id' => $entity_id,
@@ -316,7 +330,7 @@ public function testHelpdeskRenderingWithSubtreeRoot(): void
'entities_id' => $entity_id,
]);
- $subtree_child = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Subtree Child',
'locations_id' => $subtree_root->getID(),
'entities_id' => $entity_id,
@@ -368,7 +382,7 @@ public function testHelpdeskRenderingWithSelectableTreeRoot(): void
'entities_id' => $entity_id,
]);
- $child = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Root Child',
'locations_id' => $subtree_root->getID(),
'entities_id' => $entity_id,
@@ -420,13 +434,13 @@ public function testFirstDropdownShowsOnlyDirectChildren(): void
'entities_id' => $entity_id,
]);
- $root_b = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Location B',
'locations_id' => 0,
'entities_id' => $entity_id,
]);
- $child_a1 = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Location A1',
'locations_id' => $root_a->getID(),
'entities_id' => $entity_id,
@@ -523,7 +537,7 @@ public function testSubtreeDepthIsEnforcedInChildrenController(): void
'locations_id' => $level1->getID(),
'entities_id' => $entity_id,
]);
- $level3 = $this->createItem(Location::class, [
+ $this->createItem(Location::class, [
'name' => 'Level3',
'locations_id' => $level2->getID(),
'entities_id' => $entity_id,
@@ -536,6 +550,7 @@ public function testSubtreeDepthIsEnforcedInChildrenController(): void
$builder = new FormBuilder("Depth limit test");
$builder->addQuestion("Location", TreeCascadeDropdownQuestion::class, '', $extra_data);
+
$form = $this->createForm($builder);
$questions = $form->getQuestions();
@@ -591,6 +606,7 @@ public function testParentExceedingDepthLimitIsNotSelectableAndHasNoChildren():
$builder = new FormBuilder("Depth selectable test");
$builder->addQuestion("Location", TreeCascadeDropdownQuestion::class, '', $extra_data);
+
$form = $this->createForm($builder);
$questions = $form->getQuestions();
@@ -626,7 +642,7 @@ public function testHelpdeskRenderingOnlyShowsItemsFromConfiguredCustomDropdown(
$test1_class = $test1_definition->getDropdownClassName();
$test2_class = $test2_definition->getDropdownClassName();
- \Dropdown::resetItemtypesStaticCache();
+ Dropdown::resetItemtypesStaticCache();
$this->createItem($test1_class, [
'name' => 'Item from Test1',
@@ -677,7 +693,7 @@ public function testHelpdeskRenderingWithCustomDropdownAndDefaultValue(): void
$test1_class = $test1_definition->getDropdownClassName();
$test2_class = $test2_definition->getDropdownClassName();
- \Dropdown::resetItemtypesStaticCache();
+ Dropdown::resetItemtypesStaticCache();
$foreign_key = $test1_class::getForeignKeyField();
@@ -743,7 +759,7 @@ public function testHelpdeskRenderingWithCustomDropdownAndSubtreeRoot(): void
$test1_class = $test1_definition->getDropdownClassName();
$test2_class = $test2_definition->getDropdownClassName();
- \Dropdown::resetItemtypesStaticCache();
+ Dropdown::resetItemtypesStaticCache();
$foreign_key = $test1_class::getForeignKeyField();
@@ -799,12 +815,12 @@ public function testHelpdeskRenderingWithCustomDropdownAndSubtreeRoot(): void
$this->assertNotContains('Test 2 Option', $all_option_texts);
}
- private function renderHelpdeskForm(\Glpi\Form\Form $form): Crawler
+ private function renderHelpdeskForm(Form $form): Crawler
{
$this->login();
- $controller = new \Glpi\Controller\Form\RendererController();
+ $controller = new RendererController();
$response = $controller->__invoke(
- \Symfony\Component\HttpFoundation\Request::create(
+ Request::create(
'',
'GET',
['id' => $form->getID()],
diff --git a/tests/Service/ConfigManagerTest.php b/tests/Service/ConfigManagerTest.php
index 453e8b4..7857742 100644
--- a/tests/Service/ConfigManagerTest.php
+++ b/tests/Service/ConfigManagerTest.php
@@ -56,7 +56,7 @@ public function testQuestionTypeConfigFormWhenEnabled(
// Assert: the input should be checked
$testid = Toolbox::slugify($item::class);
$html_disabled = (new Crawler($html_disabled))
- ->filter("[data-testid=\"feature-$testid\"]")
+ ->filter(sprintf('[data-testid="feature-%s"]', $testid))
->filter('input[data-testid="feature-toggle"]')
->getNode(0)
;
@@ -78,7 +78,7 @@ public function testQuestionTypeConfigFormWhenDisabled(
// Assert: the input should not be checked
$testid = Toolbox::slugify($item::class);
$html_disabled = (new Crawler($html_disabled))
- ->filter("[data-testid=\"feature-$testid\"]")
+ ->filter(sprintf('[data-testid="feature-%s"]', $testid))
->filter('input[data-testid="feature-toggle"]')
->getNode(0);
$this->assertInstanceOf(DOMElement::class, $html_disabled);
diff --git a/tests/Service/InstallManagerTest.php b/tests/Service/InstallManagerTest.php
index c753a1a..3ffc3bf 100644
--- a/tests/Service/InstallManagerTest.php
+++ b/tests/Service/InstallManagerTest.php
@@ -46,6 +46,7 @@ public function testUninstallRemoveConfig(): void
foreach (self::provideQuestionTypes() as $type) {
$config_values[$type[0]->getConfigKey()] = 1;
}
+
Config::setConfigurationValues('advancedforms', $config_values);
// Act: uninstall plugin