From 493a43d9522dcac067bd48d020fa9dbd66c395c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 16 Oct 2026 10:11:58 +0200 Subject: [PATCH] fix: give the empty-field test case its own data provider --- .../Api/ApplicationFormControllerTest.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/Controller/Api/ApplicationFormControllerTest.php b/tests/Controller/Api/ApplicationFormControllerTest.php index 60e6b82..aa8fb77 100644 --- a/tests/Controller/Api/ApplicationFormControllerTest.php +++ b/tests/Controller/Api/ApplicationFormControllerTest.php @@ -274,13 +274,9 @@ class ApplicationFormControllerTest extends WebTestCase * An empty string is the shape a form posts for a field the visitor left blank, and it is as * unusable as an absent key - except for eu, where "" is a lawful no and has its own case. */ - #[\PHPUnit\Framework\Attributes\DataProvider('requiredFields')] + #[\PHPUnit\Framework\Attributes\DataProvider('nonBlankFields')] public function testAPayloadWithAnEmptyRequiredFieldIsRejected(string $field): void { - if ('eu' === $field) { - $this->markTestSkipped('An empty eu is a no, not a missing answer - see its own test'); - } - $this->post([$field => ''] + $this->payload()); $this->assertSame(Response::HTTP_BAD_REQUEST, $this->client->getResponse()->getStatusCode()); @@ -306,6 +302,21 @@ class ApplicationFormControllerTest extends WebTestCase yield 'city' => ['city']; } + /** + * The required fields that are NotBlank as well: all but eu, which is only NotNull because "" + * is a lawful no (testAnEmptyEuFlagIsNotAYes). + * + * @return iterable + */ + public static function nonBlankFields(): iterable + { + foreach (self::requiredFields() as $name => $arguments) { + if ('eu' !== $name) { + yield $name => $arguments; + } + } + } + /** * The one field whose format is nailed down: provisioning parses it as a date, so the day the * TYPO3 side switches a form back to a free-text birthday has to be a 400 here rather than a