/** * Validation constraints for request data validation * @return Assert\Collection */ public function getValidationConstraints() { return new Assert\Collection(['type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getAllDocumentTypes()])]), 'phone' => new Assert\Required([new Assert\NotBlank(), new Phone()]), 'code' => new Assert\Required([new Assert\NotBlank(), new Code()]), $this->type => new Assert\Collection([]), 'language' => new Assert\Optional(), 'message' => new Assert\Optional(), 'timestamp' => new Assert\Optional()]); }
/** * Validation constraints for fields * @return array */ public function getValidationConstraints() { return new Assert\Collection(['type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getPrimaryDocumentTypes()])]), 'file' => new Assert\Collection(['name' => new Assert\Required([new Assert\NotBlank()]), 'content' => new Assert\Required([new Assert\NotBlank()]), 'digest' => new Assert\Required([new Assert\NotBlank()])])]); }
public function testGetPrimaryDocumentTypes() { $this->assertEquals(3, count(DocumentTypeProvider::getPrimaryDocumentTypes())); }
/** * Validation constraints for fields * @return array */ public function getValidationConstraints() { return new Assert\Collection(['certificate' => new Assert\Required([new Assert\NotBlank()]), 'type' => new Assert\Required([new Assert\NotBlank(), new Assert\Choice(['choices' => DocumentTypeProvider::getAllDocumentTypes()])]), 'timestamp' => new Assert\Required([new Assert\Type(['type' => 'bool'])]), 'language' => new Assert\Required([new Assert\Choice(['choices' => ['LT', 'EN']])]), $this->type => new Assert\Collection([])]); }