diff options
author | Remi Collet <remi@remirepo.net> | 2020-09-28 16:53:02 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-09-28 16:53:02 +0200 |
commit | 7eb5acfc65f9aca4068f7e34ca5913793362d427 (patch) | |
tree | 3fcf48baa63d1b4075610a8e334a0b4defc2fa24 | |
parent | 3af3a8a065981db664e916ebe3f4571d411fed32 (diff) |
switch to classmap autoloader
-rw-r--r-- | php-phpspec-prophecy-autoload.php | 27 | ||||
-rw-r--r-- | php-phpspec-prophecy.spec | 25 |
2 files changed, 14 insertions, 38 deletions
diff --git a/php-phpspec-prophecy-autoload.php b/php-phpspec-prophecy-autoload.php deleted file mode 100644 index dfb7e08..0000000 --- a/php-phpspec-prophecy-autoload.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/* Autoloader for phpspec/prophecy and its dependencies */ - -// Rely on include_path as in PHPUnit dependencies + circular dependencies - -require_once '/usr/share/php/Fedora/Autoloader/autoload.php'; - -\Fedora\Autoloader\Autoload::addPsr4('Prophecy\\', __DIR__); - -// Dependencies -require_once 'Doctrine/Instantiator/autoload.php'; -if ($dep = stream_resolve_include_path('phpDocumentor/Reflection/DocBlock5/autoload.php')) { - require_once $dep; -} else { - trigger_error('phpDocumentor reflection docblock autoloader not found in include path', E_USER_ERROR); - exit(1); -} -unset($dep); - -if (!class_exists('SebastianBergmann\\Comparator\\Comparator')) { // v2 from phpunit, v1 from phpspec - require_once (stream_resolve_include_path('SebastianBergmann/Comparator4/autoload.php') ?: - 'SebastianBergmann/Comparator3/autoload.php'); -} -if (!class_exists('SebastianBergmann\\RecursionContext\\Context')) { // v3 from phpunit, v2 from phpspec (via exporter) - require_once (stream_resolve_include_path('SebastianBergmann/RecursionContext4/autoload.php') ?: - 'SebastianBergmann/RecursionContext3/autoload.php'); -} diff --git a/php-phpspec-prophecy.spec b/php-phpspec-prophecy.spec index 89640e4..da1a7e2 100644 --- a/php-phpspec-prophecy.spec +++ b/php-phpspec-prophecy.spec @@ -20,7 +20,7 @@ Name: php-phpspec-prophecy Version: 1.12.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Highly opinionated mocking framework for PHP License: MIT @@ -28,9 +28,6 @@ URL: https://github.com/%{gh_owner}/%{gh_project} Source0: %{name}-%{version}-%{gh_short}.tgz Source2: makesrc.sh -# Autoloader -Source1: %{name}-autoload.php - BuildArch: noarch BuildRequires: php(language) >= 7.2 %if %{with tests} @@ -97,11 +94,16 @@ to be used inside any testing framework out there with minimal effort. %prep %setup -q -n %{gh_project}-%{gh_commit} -cp %{SOURCE1} src/Prophecy/autoload.php - %build -# Nothing +phpab --template fedora --output src/Prophecy/autoload.php src +cat << 'EOF' | tee -a src/Prophecy/autoload.php + +\Fedora\Autoloader\Dependencies::required([ + '%{_datadir}/php/phpDocumentor/Reflection/DocBlock5/autoload.php', +]); +/* Comparator and RecursionContext pulled by phpspec or phpunit */ +EOF %install @@ -128,12 +130,10 @@ phpspec --version ret=0 for cmd in php php72 php73 php74; do if which $cmd; then - $cmd -d include_path=.:%{buildroot}%{_datadir}/php:%{_datadir}/php \ - -d auto_prepend_file=vendor/autoload.php \ + $cmd -d auto_prepend_file=vendor/autoload.php \ %{_bindir}/phpspec run --format pretty --verbose --no-ansi || ret=1 - $cmd -d include_path=.:%{buildroot}%{_datadir}/php:%{_datadir}/php \ - -d auto_prepend_file=vendor/autoload.php \ + $cmd -d auto_prepend_file=vendor/autoload.php \ %{_bindir}/phpunit8 || ret=1 fi done @@ -153,6 +153,9 @@ exit $ret %changelog +* Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 1.12.0-2 +- switch to classmap autoloader + * Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 1.12.0-1 - update to 1.12.0 - raise dependency on phpdocumentor/reflection-docblock 5.2 |