From 3eee5eb38e177df271518565dbda6972ac19e047 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 29 Jun 2015 19:51:39 +0200 Subject: php-phpunit-bytekit: autoloader --- php-phpunit-bytekit-autoload.patch | 48 +++++++++++++++++++++++--------------- php-phpunit-bytekit.spec | 5 +++- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/php-phpunit-bytekit-autoload.patch b/php-phpunit-bytekit-autoload.patch index 105bbd9..40d0ed2 100644 --- a/php-phpunit-bytekit-autoload.patch +++ b/php-phpunit-bytekit-autoload.patch @@ -1,10 +1,10 @@ -diff -up Bytekit/Autoload.php.orig Bytekit/Autoload.php ---- a/Bytekit/Autoload.php 2012-08-27 07:04:42.000000000 +0200 -+++ b/Bytekit/Autoload.php 2015-06-03 18:18:33.706764805 +0200 -@@ -41,16 +41,16 @@ +diff -up ./Bytekit/Autoload.php.rpm ./Bytekit/Autoload.php +--- ./Bytekit/Autoload.php.rpm 2012-08-27 07:04:42.000000000 +0200 ++++ ./Bytekit/Autoload.php 2015-06-29 19:22:45.032189615 +0200 +@@ -41,16 +41,19 @@ * @since File available since Release 1.0.0 */ - + -require_once 'Symfony/Component/Finder/Finder.php'; -require_once 'Symfony/Component/Finder/Glob.php'; -require_once 'Symfony/Component/Finder/Iterator/FilterIterator.php'; @@ -16,26 +16,36 @@ diff -up Bytekit/Autoload.php.orig Bytekit/Autoload.php -require_once 'Symfony/Component/Finder/SplFileInfo.php'; -require_once 'ezc/Base/base.php'; +$vendorDir = '/usr/share/php'; -+require_once $vendorDir . '/ezc/Base/base.php'; -+require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; -+use Symfony\Component\ClassLoader\UniversalClassLoader; ++// 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(); ++} + -+$loader = new UniversalClassLoader(); -+$loader->registerNamespaces(array( -+ 'Symfony\\Component\\Finder' => $vendorDir, -+)); -+$loader->register(); - ++/* for symfony/finder */ ++$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir); + spl_autoload_register( function($class) { ---- a/bytekit.php 2015-06-03 18:26:38.915850268 +0200 -+++ b/bytekit.php 2015-06-03 18:27:45.246135361 +0200 -@@ -46,7 +46,7 @@ +@@ -82,4 +85,5 @@ spl_autoload_register( + } + ); + ++require_once $vendorDir . '/ezc/Base/base.php'; + spl_autoload_register(array('ezcBase', 'autoload')); +diff -up ./bytekit.php.rpm ./bytekit.php +--- ./bytekit.php.rpm 2012-08-27 07:04:42.000000000 +0200 ++++ ./bytekit.php 2015-06-29 19:20:55.066655475 +0200 +@@ -46,7 +46,7 @@ if (strpos('@php_bin@', '@php_bin') === set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); } - + -require_once 'Bytekit/Autoload.php'; +require_once '/usr/share/php/Bytekit/Autoload.php'; - + $command = new Bytekit_TextUI_Command; $command->main(); diff --git a/php-phpunit-bytekit.spec b/php-phpunit-bytekit.spec index 782ac16..9fa1e11 100644 --- a/php-phpunit-bytekit.spec +++ b/php-phpunit-bytekit.spec @@ -10,7 +10,7 @@ Name: php-phpunit-bytekit Version: 1.1.3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A command-line tool built on the PHP Bytekit extension Group: Development/Libraries @@ -90,6 +90,9 @@ fi %changelog +* Mon Jun 29 2015 Remi Collet - 1.1.3-5 +- use $fedoraClassLoader autoloader + * Wed Jun 3 2015 Remi Collet - 1.1.3-4 - swicth from eZ to Zeta Components - ensure compatibility with SCL -- cgit