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