From e08835c1a2a00237cd81bcdaa02f8aafce6910e4 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Tue, 18 Nov 2025 14:00:41 +0100 Subject: [PATCH] =?UTF-8?q?:white=5Fcheck=5Fmark:=20N=C2=B08772=20-=20Abst?= =?UTF-8?q?ractFormIO=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sources/Forms/IO/AbstractFormIOTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/php-unit-tests/unitary-tests/sources/Forms/IO/AbstractFormIOTest.php b/tests/php-unit-tests/unitary-tests/sources/Forms/IO/AbstractFormIOTest.php index f878f8dff..45822d7de 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Forms/IO/AbstractFormIOTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Forms/IO/AbstractFormIOTest.php @@ -6,6 +6,7 @@ namespace Combodo\iTop\Test\UnitTest\sources\Forms\IO; +use Combodo\iTop\Forms\IO\FormBlockIOException; use Combodo\iTop\Test\UnitTest\sources\Forms\AbstractFormsTest; use Symfony\Component\Form\FormEvents; @@ -44,4 +45,28 @@ class AbstractFormIOTest extends AbstractFormsTest $this->assertTrue($oOutput->HasValue(), 'Output must have value when set'); } + public function testIOValueReflectsTheValuePostedOrTheValueSet() + { + $oInput = $this->GivenRawInput('test'); + + // When + $oInput->SetValue(FormEvents::POST_SET_DATA, 'The value set'); + + // Then + $this->assertEquals('The value set', $oInput->GetValue()); + + // When + $oInput->SetValue(FormEvents::POST_SUBMIT, 'The value posted'); + + // Then + $this->assertEquals('The value posted', $oInput->GetValue()); + } + + public function testNameDoesNotAcceptBlank() + { + $oInput = $this->GivenRawInput('test'); + + $this->expectException(FormBlockIOException::class); + $oInput->SetName('The test name'); + } }