[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#67902] [PATCH 72/95] gnu: Add php-symfony-phpunit-bridge.
From: |
Nicolas Graves |
Subject: |
[bug#67902] [PATCH 72/95] gnu: Add php-symfony-phpunit-bridge. |
Date: |
Tue, 19 Dec 2023 14:57:53 +0100 |
* gnu/packages/php-xyz.scm (php-symfony-phpunit-bridge): New variable.
* gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch:
New file.
Change-Id: Ie72bd332a6fb7aaf96a59ce24e6008e6aa599f59
---
...ymfony-phpunit-bridge-getVendors-fix.patch | 46 +++++++++++
gnu/packages/php-xyz.scm | 77 +++++++++++++++++++
2 files changed, 123 insertions(+)
create mode 100644
gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch
diff --git
a/gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch
b/gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch
new file mode 100644
index 0000000000..fd48e2ce6c
--- /dev/null
+++ b/gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch
@@ -0,0 +1,46 @@
+From 4b7c29c3e98aa55ea7567a3d496595e539f30cdb Mon Sep 17 00:00:00 2001
+From: Nicolas Graves <ngraves@ngraves.fr>
+Date: Sun, 22 Oct 2023 16:31:40 +0200
+Subject: [PATCH] Deprecation.php: Do not check for composer in getVendors.
+
+---
+ DeprecationErrorHandler/Deprecation.php | 23 ++---------------------
+ 1 file changed, 2 insertions(+), 21 deletions(-)
+
+diff --git a/DeprecationErrorHandler/Deprecation.php
b/DeprecationErrorHandler/Deprecation.php
+index 79cfa0c..b7074f7 100644
+--- a/DeprecationErrorHandler/Deprecation.php
++++ b/DeprecationErrorHandler/Deprecation.php
+@@ -365,27 +365,8 @@ class Deprecation
+ if (class_exists(DebugClassLoader::class, false)) {
+ self::$vendors[] = \dirname((new
\ReflectionClass(DebugClassLoader::class))->getFileName());
+ }
+- foreach (get_declared_classes() as $class) {
+- if ('C' === $class[0] && 0 === strpos($class,
'ComposerAutoloaderInit')) {
+- $r = new \ReflectionClass($class);
+- $v = \dirname($r->getFileName(), 2);
+- if (file_exists($v.'/composer/installed.json')) {
+- self::$vendors[] = $v;
+- $loader = require $v.'/autoload.php';
+- $paths = self::addSourcePathsFromPrefixes(
+- array_merge($loader->getPrefixes(),
$loader->getPrefixesPsr4()),
+- $paths
+- );
+- }
+- }
+- }
+- foreach ($paths as $path) {
+- foreach (self::$vendors as $vendor) {
+- if (0 !== strpos($path, $vendor)) {
+- self::$internalPaths[] = $path;
+- }
+- }
+- }
++ self::$vendors[] = $v;
++ self::$internalPaths[] = $paths;
+ }
+
+ return self::$vendors;
+--
+2.41.0
+
diff --git a/gnu/packages/php-xyz.scm b/gnu/packages/php-xyz.scm
index 6cd3295b85..d6a49d1f75 100644
--- a/gnu/packages/php-xyz.scm
+++ b/gnu/packages/php-xyz.scm
@@ -1954,3 +1954,80 @@ (define-public php-symfony-mime
(home-page "https://symfony.com")
(license license:expat)))
+(define-public php-symfony-phpunit-bridge
+ (package
+ (name "php-symfony-phpunit-bridge")
+ (version "6.3.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/symfony/phpunit-bridge")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1v5zdjb0d7282wq0ghwzn9x005wqlzjmx2msi9vhp1c4l513fxgf"))
+ (patches
+ (search-patches "php-symfony-phpunit-bridge-getVendors-fix.patch"))))
+ (build-system composer-build-system)
+ (arguments
+ (list
+ #:test-flags ; Some tests are useless but get reported as risky.
+ ''("--bootstrap" "vendor/autoload.php" "--dont-report-useless-tests")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'deactivate-bootstrap.php
+ (lambda _
+ (substitute* "composer.json"
+ ((".*\"files\".*")
+ ""))))
+ (add-before 'check 'pre-check
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Adapt some PHP test code to Guix context.
+ (mkdir-p
+ (string-append (getcwd) "/vendor/myfakevendor/myfakepackage1"))
+ (substitute* "Tests/DeprecationErrorHandler/DeprecationTest.php"
+ (("(.*)self::\\$vendorDir = \\$vendorDir;" all blank)
+ (string-append
+ blank "$vendorDir = '" (getcwd) "/vendor/';\n"
+ all)))
+ (substitute* "DeprecationErrorHandler/Deprecation.php"
+ (("(self::\\$vendors\\[\\] = )\\$v;" all eq)
+ (string-append eq "'" (getcwd) "/vendor';"))
+ (("(self::\\$internalPaths)\\[\\] = \\$paths;" all def)
+ (string-append
+ def " = ["
+ "'" (getcwd)
"/Tests/DeprecationErrorHandler/Deprecation.php',"
+ "'" (getcwd)
"/Tests/DeprecationErrorHandler/DeprecationTest.php',"
+ "'" (getcwd) "/Tests/DeprecationErrorHandler.php',"
+ "];")))
+ ;; Remove failing tests. All but two are probably failing
+ ;; because of some version mismatch of php-symfony-error-handler.
+ (for-each
+ (lambda (f)
+ (delete-file
+ (string-append "Tests/DeprecationErrorHandler/" f)))
+ '("partially_quiet.phpt"
+ "partially_quiet2.phpt"
+ "trigger_deprecation_types.phpt"
+ "trigger_error_types.phpt"
+ "weak_vendors_on_vendor.phpt"))
+ (delete-file "Tests/CoverageListenerTest.php")
+ ;; For most simple cases, handle php-symfony-error-handler
+ ;; discrepancies.
+ (substitute* (find-files "Tests" "\\.phpt")
+ (("Remaining indirect deprecation notices")
+ "Other deprecation notices")
+ (("Remaining direct deprecation notices")
+ "Other deprecation notices")))))))
+ (native-inputs
+ (list php-phpunit-phpunit
+ php-symfony-deprecation-contracts
+ php-symfony-error-handler))
+ (synopsis "Utilities for PHPUnit")
+ (description
+ "This package provides utilities for PHPUnit, especially user deprecation
+notices management.")
+ (home-page "https://symfony.com")
+ (license license:expat)))
+
--
2.41.0
- [bug#67902] [PATCH 54/95] gnu: Add php-symfony-cache., (continued)
- [bug#67902] [PATCH 54/95] gnu: Add php-symfony-cache., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 61/95] gnu: Add php-symfony-error-handler., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 62/95] gnu: Add php-symfony-event-dispatcher., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 63/95] gnu: Add php-symfony-event-dispatcher-contracts., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 66/95] gnu: Add php-symfony-finder., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 68/95] gnu: Add php-symfony-http-kernel., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 70/95] gnu: Add php-symfony-lock., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 69/95] gnu: Add php-symfony-intl., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 71/95] gnu: Add php-symfony-mime., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 73/95] gnu: Add php-symfony-process., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 72/95] gnu: Add php-symfony-phpunit-bridge.,
Nicolas Graves <=
- [bug#67902] [PATCH 78/95] gnu: Add php-symfony-polyfill-intl-normalizer., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 77/95] gnu: Add php-symfony-polyfill-intl-idn., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 81/95] gnu: Add php-symfony-service-contracts., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 82/95] gnu: Add php-symfony-stopwatch., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 90/95] gnu: Add php-doctrine-annotations., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 92/95] gnu: Add php-theseer-tokenizer., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 83/95] gnu: Add php-symfony-string., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 86/95] gnu: Add php-symfony-var-dumper., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 87/95] gnu: Add php-symfony-var-exporter., Nicolas Graves, 2023/12/19
- [bug#67902] [PATCH 88/95] gnu: Add php-symfony-yaml., Nicolas Graves, 2023/12/19