function validateCodepostalHTTPInput($codepostal, $contentObjectAttribute) { if (!CodePostal::validate($codepostal)) { $contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The Postcode is not valid.')); return eZInputValidator::STATE_INVALID; } return eZInputValidator::STATE_ACCEPTED; }
public function testEmptyCodePostalAsInvalid() { $this->assertEquals(CodePostal::validate(''), false); $this->assertEquals(CodePostal::validate(' '), false); }