[packages/phpunit/dev-4.8: 2/2] update autoloader
glen
glen at pld-linux.org
Mon Jul 17 21:10:04 CEST 2017
commit 7fec05e06c3da8705aa763f5a809b0f50ef80048
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Wed May 3 21:54:09 2017 +0300
update autoloader
autoload.patch | 26 ++++++++++++++++++------
autoload.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
phpunit.spec | 21 ++++++++++++-------
3 files changed, 98 insertions(+), 13 deletions(-)
---
diff --git a/phpunit.spec b/phpunit.spec
index a846042..87b21de 100644
--- a/phpunit.spec
+++ b/phpunit.spec
@@ -1,4 +1,3 @@
-%define status stable
%define pearname PHPUnit
%define php_min_version 5.3.3
%include /usr/lib/rpm/macros.php
@@ -7,11 +6,12 @@ Summary(pl.UTF-8): %{pearname} - zestaw testów regresyjnych
Name: phpunit
# use last version supporting php 5.3
Version: 4.8.35
-Release: 0.1
+Release: 0.2
License: BSD
Group: Development/Languages/PHP
Source0: https://github.com/sebastianbergmann/phpunit/archive/%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 38880d4f16fa246e544470ad0027a3cb
+Source1: autoload.php
Patch0: autoload.patch
URL: https://phpunit.de/
BuildRequires: php-channel(components.ez.no)
@@ -19,6 +19,7 @@ BuildRequires: php-channel(pear.phpunit.de)
BuildRequires: php-channel(pear.symfony-project.com)
BuildRequires: php-pear >= 4:1.1-2
BuildRequires: php-pear-PEAR >= 1:1.9.4
+BuildRequires: phpab
BuildRequires: rpm-php-pearprov >= 4.4.2-11
BuildRequires: rpmbuild(macros) >= 1.580
Requires: php(core) >= %{php_min_version}
@@ -36,6 +37,7 @@ Requires: php-phpunit-PHP_CodeCoverage <= 1.2.99
Requires: php-phpunit-PHP_CodeCoverage >= 1.2.1
Requires: php-phpunit-PHP_Timer >= 1.0.4
Requires: php-phpunit-Text_Template >= 1.1.1
+Requires: php-sebastian-diff
Requires: php-symfony2-Yaml <= 2.99.99
Requires: php-symfony2-Yaml >= 2.0
Suggests: php(json)
@@ -57,24 +59,29 @@ PHPUnit is a regression testing framework used by the developer who
implements unit tests in PHP. It is based upon JUnit, which can be
found at <http://www.junit.org/>.
-In PEAR status of this package is: %{status}.
-
%description -l pl.UTF-8
PHPUnit jest zestawem testów regresyjnych używanych przez developerów,
którzy implementują jednostki testowe w PHP. Jest bazowane na JUnit,
który można znaleźć pod adresem <http://www.junit.org/>.
-Ta klasa ma w PEAR status: %{status}.
-
%prep
%setup -q
%patch0 -p1
+# Restore PSR-0 tree
+mv src PHPUnit
+
+%build
+phpab \
+ --output PHPUnit/Autoload.php \
+ --template %{SOURCE1} \
+ PHPUnit
+
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{php_pear_dir},%{_bindir}}
cp -a PHPUnit $RPM_BUILD_ROOT%{php_pear_dir}
-install -p phpunit.php $RPM_BUILD_ROOT%{_bindir}/%{name}
+install -p phpunit $RPM_BUILD_ROOT%{_bindir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
diff --git a/autoload.patch b/autoload.patch
index e7869a2..f4705cd 100644
--- a/autoload.patch
+++ b/autoload.patch
@@ -1,17 +1,31 @@
---- phpunit-4.8.35/phpunit~ 2017-05-03 21:31:46.000000000 +0300
-+++ phpunit-4.8.35/phpunit 2017-05-03 21:33:36.879408483 +0300
+--- phpunit-4.8.35/phpunit 2017-05-03 21:33:36.879408483 +0300
++++ phpunit-4.8.35/phpunit 2017-05-03 21:51:23.888284948 +0300
@@ -1,4 +1,4 @@
-#!/usr/bin/env php
+#!/usr/bin/php
<?php
/* PHPUnit
*
-@@ -27,7 +27,7 @@
+@@ -27,16 +27,14 @@
ini_set('date.timezone', 'UTC');
}
-foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
-+foreach (array('/usr/share/php/PHPUnit/autoload.php', __DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
- if (file_exists($file)) {
- define('PHPUNIT_COMPOSER_INSTALL', $file);
+- if (file_exists($file)) {
+- define('PHPUNIT_COMPOSER_INSTALL', $file);
+-
+- break;
+- }
++// Libraries PATH
++if (file_exists('./vendor/phpunit/phpunit/phpunit') && file_exists('./vendor/autoload.php')) {
++ echo "\n==== Redirecting to composer installed version in vendor/phpunit ====\n\n";
++ define('PHPUNIT_COMPOSER_INSTALL', realpath('./vendor/autoload.php'));
++} else {
++ define('PHPUNIT_COMPOSER_INSTALL', stream_resolve_include_path('PHPUnit/Autoload.php'));
+ }
+-unset($file);
+-
+ if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
+ fwrite(STDERR,
+ 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
diff --git a/autoload.php b/autoload.php
new file mode 100644
index 0000000..e39d1da
--- /dev/null
+++ b/autoload.php
@@ -0,0 +1,64 @@
+<?php
+/* Autoloader for phpunit/phpunit and its dependencies */
+
+/* Required */
+require_once 'File/Iterator/Autoload.php';
+require_once 'PHP/CodeCoverage/Autoload.php';
+require_once 'PHP/Timer/Autoload.php';
+require_once 'PHPUnit/Framework/MockObject/Autoload.php';
+require_once 'Text/Template/Autoload.php';
+require_once 'PHP/Invoker/Autoload.php';
+require_once 'SebastianBergmann/Diff/autoload.php';
+require_once 'SebastianBergmann/Environment/autoload.php';
+require_once 'SebastianBergmann/Exporter/autoload.php';
+require_once 'SebastianBergmann/Version/autoload.php';
+require_once 'SebastianBergmann/Comparator/autoload.php';
+require_once 'SebastianBergmann/GlobalState/autoload.php';
+require_once 'Doctrine/Instantiator/autoload.php';
+require_once 'Prophecy/autoload.php';
+
+$vendorDir = stream_resolve_include_path('Symfony/Component/ClassLoader/ClassLoader.php');
+$vendorDir = dirname(dirname(dirname(dirname($vendorDir))));
+// Use Symfony autoloader
+if (!isset($classLoader) || !($classLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $classLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $classLoader->register();
+}
+
+/* for symfony/yaml */
+$classLoader->addPrefix('Symfony\\Component\\', $vendorDir);
+
+spl_autoload_register(
+ function ($class)
+ {
+ static $classes = NULL;
+
+ if ($classes === NULL) {
+ $classes = array(
+ ___CLASSLIST___
+ );
+ }
+
+ $cn = strtolower($class);
+
+ if (isset($classes[$cn])) {
+ require __DIR__ . $classes[$cn];
+ }
+ }
+);
+
+/* Optional */
+foreach(array(
+ 'PHPUnit/Extensions/Database/Autoload.php',
+ 'PHPUnit/Extensions/SeleniumCommon/Autoload.php',
+ 'PHPUnit/Extensions/SeleniumTestCase/Autoload.php',
+ 'PHPUnit/Extensions/Story/Autoload.php'
+ ) as $opt) {
+ if ($fic = stream_resolve_include_path($opt)) {
+ require_once $fic;
+ }
+}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/phpunit.git/commitdiff/7fec05e06c3da8705aa763f5a809b0f50ef80048
More information about the pld-cvs-commit
mailing list