summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-29 17:19:13 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-29 17:19:13 +0200
commit08a7d2937d39cddd32d38a18260f5b679a561da4 (patch)
tree83a2fdb597667d12ccfb7a7ce99d13df37d002b6
parent5e462d9c74e174b5e81f16de6d43202c49915da6 (diff)
php-phpunit-PHPUnit-SkeletonGenerator: autoloader
-rw-r--r--autoload.php.in31
-rw-r--r--php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch6
-rw-r--r--php-phpunit-PHPUnit-SkeletonGenerator.spec24
3 files changed, 34 insertions, 27 deletions
diff --git a/autoload.php.in b/autoload.php.in
index bc903fc..3b4586b 100644
--- a/autoload.php.in
+++ b/autoload.php.in
@@ -1,20 +1,27 @@
<?php
-/* inspired from autoload from version 1.2.1 */
+/* Autoloader for phpunit/phpunit-skeleton-generator and its dependencies */
-$phpdir = '/usr/share/php';
+$vendorDir = '/usr/share/php';
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
-require_once $phpdir.'/Text/Template/Autoload.php';
+/* for symfony/console */
+$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir);
-require_once $phpdir.'/SebastianBergmann/Version/autoload.php';
+/* optional, for test suite */
+if (is_dir($vendorDir . '/org/bovigo/vfs')) {
+ $fedoraClassLoader->addPrefix('org\\bovigo\\vfs', $vendorDir);
+}
-require_once $phpdir.'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
-$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
-$loader->registerNamespaces(array(
- 'Symfony\\Component\\Console' => $phpdir,
- 'Symfony\\Component\\ClassLoader' => $phpdir,
- 'org\\bovigo\\vfs' => $phpdir,
-));
-$loader->register();
+require_once $vendorDir . '/Text/Template/Autoload.php';
+require_once $vendorDir . '/SebastianBergmann/Version/autoload.php';
spl_autoload_register(
function($class) {
diff --git a/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch b/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch
index 7f370df..db8c08e 100644
--- a/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch
+++ b/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch
@@ -1,12 +1,6 @@
diff -up phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen.rpm phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen
--- phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen.rpm 2014-05-13 15:03:03.000000000 +0200
+++ phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen 2014-05-13 15:04:42.000000000 +0200
-@@ -1,4 +1,4 @@
--#!/usr/bin/env php
-+#!/usr/bin/php
- <?php
- /**
- * phpunit-skeleton-generator
@@ -42,23 +42,7 @@
* @since File available since Release 1.0.0
*/
diff --git a/php-phpunit-PHPUnit-SkeletonGenerator.spec b/php-phpunit-PHPUnit-SkeletonGenerator.spec
index ce105bb..48c143c 100644
--- a/php-phpunit-PHPUnit-SkeletonGenerator.spec
+++ b/php-phpunit-PHPUnit-SkeletonGenerator.spec
@@ -1,4 +1,4 @@
-# spec file for php-phpunit-PHPUnit-SkeletonGenerator
+# remirepo/fedora spec file for php-phpunit-PHPUnit-SkeletonGenerator
#
# Copyright (c) 2012-2015 Remi Collet
# License: CC-BY-SA
@@ -17,7 +17,7 @@
Name: php-phpunit-PHPUnit-SkeletonGenerator
Version: 2.0.1
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Tool that can generate skeleton test classes
Group: Development/Libraries
@@ -36,15 +36,19 @@ BuildArch: noarch
BuildRequires: php(language) >= 5.3.3
BuildRequires: %{_bindir}/phpab
%if %{with_tests}
-BuildRequires: %{_bindir}/phpunit
BuildRequires: php-composer(phpunit/php-text-template) >= 1.2
BuildRequires: php-composer(sebastian/version) >= 1.0
BuildRequires: php-composer(symfony/console) >= 2.4
-BuildRequires: php-composer(symfony/class-loader) >= 2.4
+# From composer.json, requires-dev
+# "mikey179/vfsStream": "~1.2"
+# "phpunit/phpunit": "~4.0",
BuildRequires: php-composer(mikey179/vfsStream) >= 1.2
+BuildRequires: %{_bindir}/phpunit
+# For our autoloader
+BuildRequires: php-composer(symfony/class-loader)
%endif
-# From composer.json
+# From composer.json, requires
# "php": ">=5.3.3",
# "phpunit/php-text-template": "~1.2",
# "sebastian/version": "~1.0",
@@ -57,8 +61,7 @@ Requires: php-composer(sebastian/version) < 2
Requires: php-composer(symfony/console) >= 2.4
Requires: php-composer(symfony/console) < 3
# Need for our autoloader patch
-Requires: php-composer(symfony/class-loader) >= 2.4
-Requires: php-composer(symfony/class-loader) < 3
+Requires: php-composer(symfony/class-loader)
# From phpcompatinfo report from 2.0.0
Requires: php-date
Requires: php-pcre
@@ -104,8 +107,8 @@ rm -rf %{buildroot}
%check
cd build
phpunit \
- -d date.timezone=UTC \
- --bootstrap ../src/autoload.php
+ --bootstrap %{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator/autoload.php \
+ --verbose
%endif
@@ -126,6 +129,9 @@ fi
%changelog
+* Mon Jun 29 2015 Remi Collet <remi@fedoraproject.org> - 2.0.1-3
+- use $fedoraClassLoader autoloader
+
* Tue Jul 22 2014 Remi Collet <remi@fedoraproject.org> - 2.0.1-2
- composer dependencies