summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-29 15:15:08 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-29 15:15:08 +0200
commitfba02f343af7f1d8b87b8df0e3152260942c85f8 (patch)
tree06d420d4e2efbd380cde228d81063cf9b8d348ca
parentdc8ea32fe76b2dabc3c1195f4f0e154f4c5a4a4b (diff)
php-phpspec-prophecy: autoloader
-rw-r--r--php-phpspec-prophecy-autoload.php20
-rw-r--r--php-phpspec-prophecy.spec30
2 files changed, 36 insertions, 14 deletions
diff --git a/php-phpspec-prophecy-autoload.php b/php-phpspec-prophecy-autoload.php
new file mode 100644
index 0000000..1e8dfe4
--- /dev/null
+++ b/php-phpspec-prophecy-autoload.php
@@ -0,0 +1,20 @@
+<?php
+/* Autoloader for phpspec/prophecy and its dependencies */
+
+$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();
+}
+
+$fedoraClassLoader->addPrefix('Prophecy\\', dirname(__DIR__));
+
+// Depdencies (Rely on include_path as in PHPUnit dependencies + circular dependencies)
+require_once 'Doctrine/Instantiator/autoload.php';
+require_once 'SebastianBergmann/Comparator/autoload.php';
+require_once 'phpDocumentor/Reflection/DocBlock/autoload.php';
diff --git a/php-phpspec-prophecy.spec b/php-phpspec-prophecy.spec
index ade2f8b..65aed5f 100644
--- a/php-phpspec-prophecy.spec
+++ b/php-phpspec-prophecy.spec
@@ -6,7 +6,7 @@
#
# Please, preserve the changelog entries
#
-%global bootstrap 1
+%global bootstrap 0
%global gh_commit 3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner phpspec
@@ -20,7 +20,7 @@
Name: php-phpspec-prophecy
Version: 1.4.1
-Release: 1%{?dist}
+Release: 4%{?dist}
Summary: Highly opinionated mocking framework for PHP
Group: Development/Libraries
@@ -28,11 +28,15 @@ License: MIT
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+# Autoloader
+Source1: %{name}-autoload.php
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-BuildRequires: %{_bindir}/phpab
%if %{with_tests}
BuildRequires: %{_bindir}/phpspec
+# For autoloader
+BuildRequires: php-composer(symfony/class-loader)
%endif
# from composer.json, requires
@@ -51,6 +55,8 @@ Requires: php(language) >= 5.3.0
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
+# For autoloader
+Requires: php-composer(symfony/class-loader)
Provides: php-composer(phpspec/prophecy) = %{version}
@@ -66,19 +72,11 @@ 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
-: Generate a simple autoloader
-%{_bindir}/phpab --output src/Prophecy/autoload.php src/Prophecy
-
-# Rely on include_path as in PHPUnit dependencies + circular dependencies
-cat <<EOF | tee -a src/Prophecy/autoload.php
-// Dependencies' autoloaders
-require_once 'Doctrine/Instantiator/autoload.php';
-require_once 'SebastianBergmann/Comparator/autoload.php';
-require_once 'phpDocumentor/Reflection/DocBlock/autoload.php';
-EOF
+%build
+# Nothing
%install
rm -rf %{buildroot}
@@ -111,6 +109,10 @@ rm -rf %{buildroot}
%changelog
+* Mon Jun 29 2015 Remi Collet <remi@fedoraproject.org> - 1.4.1-4
+- use symfony/class-loader
+- enable test suite
+
* Tue Apr 28 2015 Remi Collet <remi@fedoraproject.org> - 1.4.1-1
- update to 1.4.1