[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#67902] [PATCH v3 73/96] gnu: Add php-symfony-phpunit-bridge.
From: |
Nicolas Graves |
Subject: |
[bug#67902] [PATCH v3 73/96] gnu: Add php-symfony-phpunit-bridge. |
Date: |
Mon, 7 Oct 2024 02:00:08 +0200 |
* 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 e9a6a0e0d3..9bdd943f63 100644
--- a/gnu/packages/php-xyz.scm
+++ b/gnu/packages/php-xyz.scm
@@ -1946,3 +1946,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.46.0
- [bug#67902] [PATCH v3 60/96] gnu: Add php-symfony-dependency-injection., (continued)
- [bug#67902] [PATCH v3 60/96] gnu: Add php-symfony-dependency-injection., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 81/96] gnu: Add php-symfony-polyfill-uuid., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 79/96] gnu: Add php-symfony-polyfill-intl-normalizer., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 61/96] gnu: Add php-symfony-deprecation-contracts., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 62/96] gnu: Add php-symfony-error-handler., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 63/96] gnu: Add php-symfony-event-dispatcher., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 68/96] gnu: Add php-symfony-http-foundation., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 70/96] gnu: Add php-symfony-intl., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 69/96] gnu: Add php-symfony-http-kernel., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 67/96] gnu: Add php-symfony-finder., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 73/96] gnu: Add php-symfony-phpunit-bridge.,
Nicolas Graves <=
- [bug#67902] [PATCH v3 77/96] gnu: Add php-symfony-polyfill-intl-grapheme., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 85/96] gnu: Add php-symfony-translation-contracts., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 82/96] gnu: Add php-symfony-service-contracts., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 88/96] gnu: Add php-symfony-var-exporter., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 87/96] gnu: Add php-symfony-var-dumper., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 74/96] gnu: Add php-symfony-process., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 83/96] gnu: Add php-symfony-stopwatch., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 76/96] gnu: Add php-symfony-polyfill-ctype., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 80/96] gnu: Add php-symfony-polyfill-mbstring., Nicolas Graves, 2024/10/06
- [bug#67902] [PATCH v3 86/96] gnu: Add php-symfony-uid., Nicolas Graves, 2024/10/06