Skip to content

Commit 0b3525f

Browse files
Small refactor
1 parent 675e60a commit 0b3525f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/Front/ConfigFormTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,41 @@ public function testTabHasContentExistOnConfigPage(): void
6767
public function testCanDisableQuestionTypeIpConfig(): void
6868
{
6969
// Arrange: enable config
70+
$manager = $this->getConfigManager();
7071
Config::setConfigurationValues('advancedforms', [
7172
ConfigManager::CONFIG_ENABLE_QUESTION_TYPE_IP => 1,
7273
]);
73-
$this->assertTrue($this->getConfigManager()->getConfig()->isIpAddressQuestionTypeEnabled());
74+
$this->assertTrue($manager->getConfig()->isIpAddressQuestionTypeEnabled());
7475

7576
// Act: submit config form
7677
$this->post("/front/config.form.php", [
7778
'config_context' => 'advancedforms',
7879
'update' => 1,
7980
ConfigManager::CONFIG_ENABLE_QUESTION_TYPE_IP => 0,
8081
]);
81-
$this->assertFalse($this->getConfigManager()->getConfig()->isIpAddressQuestionTypeEnabled());
82+
83+
// Assert: config should now be disabled
84+
$this->assertFalse($manager->getConfig()->isIpAddressQuestionTypeEnabled());
8285
}
8386

8487
public function testCanEnableQuestionTypeIpConfig(): void
8588
{
8689
// Arrange: disable config
90+
$manager = $this->getConfigManager();
8791
Config::setConfigurationValues('advancedforms', [
8892
ConfigManager::CONFIG_ENABLE_QUESTION_TYPE_IP => 0,
8993
]);
90-
$this->assertFalse($this->getConfigManager()->getConfig()->isIpAddressQuestionTypeEnabled());
94+
$this->assertFalse($manager->getConfig()->isIpAddressQuestionTypeEnabled());
9195

9296
// Act: submit config form
9397
$this->post("/front/config.form.php", [
9498
'config_context' => 'advancedforms',
9599
'update' => 1,
96100
ConfigManager::CONFIG_ENABLE_QUESTION_TYPE_IP => 1,
97101
]);
98-
$this->assertTrue($this->getConfigManager()->getConfig()->isIpAddressQuestionTypeEnabled());
102+
103+
// Assert: config should now be enabled
104+
$this->assertTrue($manager->getConfig()->isIpAddressQuestionTypeEnabled());
99105
}
100106

101107
private function getConfigManager(): ConfigManager

0 commit comments

Comments
 (0)