File: Make-the-autoload-and-source-path-configurable.patch

package info (click to toggle)
phing 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,548 kB
  • sloc: php: 59,817; xml: 9,767; sql: 78; makefile: 39; sh: 14
file content (65 lines) | stat: -rw-r--r-- 1,891 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From: William Desportes <williamdes@wdes.fr>
Date: Mon, 14 Apr 2025 16:46:13 +0200
Subject: Make the autoload and source path configurable

Origin: vendor
Forwarded: not-needed
---
 tests/bootstrap.php | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 3b6bef3..d34453c 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -3,20 +3,41 @@
 use Phing\Phing;
 
 defined('PHING_TEST_BASE') || define('PHING_TEST_BASE', __DIR__);
+$phingSource = getenv('PHING_SOURCE');
+
+if (! is_string($phingSource)) {
+    echo 'PHING_SOURCE is not set';
+    exit(1);
+}
+
+$phingSource = realpath(rtrim($phingSource, '/'));
+
+if (! is_dir($phingSource)) {
+    echo 'PHING_SOURCE is not a folder: ' . $phingSource;
+    exit(1);
+}
+
 set_include_path(
-    realpath(__DIR__ . '/../src') . PATH_SEPARATOR .
-    realpath(__DIR__ . '/src') . PATH_SEPARATOR .
-    get_include_path()  // trunk version of phing classes should take precedence
+    $phingSource . PATH_SEPARATOR . '/usr/share/php'
 );
 
-// Use composers autoload.php if available
-if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
-    require_once __DIR__ . '/../vendor/autoload.php';
-} elseif (file_exists(__DIR__ . '/../../../autoload.php')) {
-    require_once __DIR__ . '/../../../autoload.php';
+$phingAutoload = getenv('PHING_AUTOLOAD');
+
+if (! is_string($phingAutoload)) {
+    echo 'PHING_AUTOLOAD is not set';
+    exit(1);
 }
 
-Phing::setProperty('phing.home', realpath(__DIR__ . '/../'));
+$phingAutoload = realpath($phingAutoload);
+
+if (! is_file($phingAutoload)) {
+    echo 'PHING_AUTOLOAD is not a file: ' . $phingAutoload;
+    exit(1);
+}
+
+require_once $phingAutoload;
+
+Phing::setProperty('phing.home', $phingSource);
 Phing::startup();
 
 error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE);