Subject: [PATCH v4 13/98] gnu: Add php-egulias-email-validator.

From: Nicolas Graves <[email-masked]>
Date: Mon, 7 Oct 2024 23:43:41 +0200

* gnu/packages/php-xyz.scm (php-egulias-email-validator): New variable.

Change-Id: I2a9df3ca79962aa01ce3a7a8e7d7da536350249a
---
 gnu/packages/php-xyz.scm | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/php-xyz.scm b/gnu/packages/php-xyz.scm
index a27098e18d..28e1e5cd4b 100644
--- a/gnu/packages/php-xyz.scm
+++ b/gnu/packages/php-xyz.scm
@@ -278,3 +278,50 @@ (define-public php-dms-phpunit-arraysubset-asserts
     (home-page "https://github.com/rdohms/phpunit-arraysubset-asserts")
     (license license:expat)))
 
+(define-public php-egulias-email-validator
+  (package
+    (name "php-egulias-email-validator")
+    (version "4.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/egulias/EmailValidator")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nyqri3421gkiswn70f7f8cfz4vs1vcadxdyvwjykbgc4fz5skz2"))))
+    (build-system composer-build-system)
+    (arguments
+     (list
+      #:test-flags ''("--exclude" "skipTest") ; FIXME
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'deactivate-failing-tests
+            (lambda _
+              (substitute*
+                  "tests/EmailValidator/Validation/DNSCheckValidationTest.php"
+                (("(.*)@dataProvider validEmailsProvider" all blank)
+                 (string-append all "\n"
+                                blank "@group skipTest"))
+                (("(.*)public function testDomainAcceptsNoMailError\\(\\)" all blank)
+                 (string-append
+                  blank "/**\n"
+                  blank " * @group skipTest\n"
+                  blank " */\n"
+                  all))
+                (("(.*)public function testNoDNSError\\(\\)" all blank)
+                 (string-append
+                  blank "/**\n"
+                  blank " * @group skipTest\n"
+                  blank " */\n"
+                  all))))))))
+    (inputs
+     (list php-doctrine-lexer php-symfony-polyfill-intl-idn))
+    (native-inputs
+     (list php-phpunit-phpunit))
+    (synopsis "PHP email address validator")
+    (description "A library for validating emails against several RFCs")
+    (home-page "https://github.com/egulias/EmailValidator")
+    (license license:expat)))
+
-- 
2.46.0