[php-symfony2-Console] Added tests
Shawn Iwinski
siwinski at fedoraproject.org
Sat Oct 20 02:42:39 UTC 2012
commit 3f718b1f20f85443f2dbd3ee4885ef5db8ae71d7
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date: Fri Oct 19 22:42:05 2012 -0400
Added tests
php-symfony2-Console.spec | 45 ++++++++++++++++++++++++++++++++++++++++++---
tests-bootstrap.patch | 24 ++++++++++++++++++++++++
2 files changed, 66 insertions(+), 3 deletions(-)
---
diff --git a/php-symfony2-Console.spec b/php-symfony2-Console.spec
index d270916..06b3d52 100644
--- a/php-symfony2-Console.spec
+++ b/php-symfony2-Console.spec
@@ -2,6 +2,7 @@
%global pear_channel pear.symfony.com
%global pear_name %(echo %{name} | sed -e 's/^php-symfony2-//' -e 's/-/_/g')
+%global php_min_ver 5.3.3
Name: php-symfony2-Console
Version: 2.1.2
@@ -12,12 +13,26 @@ Group: Development/Libraries
License: MIT
URL: http://symfony.com/doc/current/components/console.html
Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
+Patch0: tests-bootstrap.patch
BuildArch: noarch
+
BuildRequires: php-pear(PEAR)
BuildRequires: php-channel(%{pear_channel})
+# Test requires
+BuildRequires: php-common >= %{php_min_ver}
+BuildRequires: php-pear(pear.phpunit.de/PHPUnit)
+# Test requires: phpci
+Requires: php-dom
+Requires: php-json
+Requires: php-mbstring
+Requires: php-pcre
+Requires: php-posix
+Requires: php-readline
+Requires: php-reflection
+Requires: php-spl
-Requires: php-common >= 5.3.3
+Requires: php-common >= %{php_min_ver}
Requires: php-pear(PEAR)
Requires: php-channel(%{pear_channel})
Requires(post): %{__pear}
@@ -45,6 +60,21 @@ other batch jobs.
%prep
%setup -q -c
+
+# Patches
+cd %{pear_name}-%{version}
+%patch0 -p0
+cd ..
+
+# Modify PEAR package.xml file:
+# - Change role from "php" to "doc" for CHANGELOG.md file
+# - Change role from "php" to "test" for all test files
+sed -e '/CHANGELOG.md/s/role="php"/role="doc"/' \
+ -e '/phpunit.xml.dist/s/role="php"/role="test"/' \
+ -e '/Tests/s/role="php"/role="test"/' \
+ -e '/bootstrap.php/s/md5sum="[^"]*"\s*//' \
+ -i package.xml
+
# package.xml is version 2.0
mv package.xml %{pear_name}-%{version}/%{name}.xml
@@ -65,6 +95,11 @@ mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
+%check
+cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}
+%{_bindir}/phpunit
+
+
%post
%{__pear} install --nodeps --soft --force --register-only \
%{pear_xmldir}/%{name}.xml >/dev/null || :
@@ -83,13 +118,17 @@ fi
%dir %{pear_phpdir}/Symfony
%dir %{pear_phpdir}/Symfony/Component
%{pear_phpdir}/Symfony/Component/%{pear_name}
+%{pear_testdir}/%{pear_name}
%changelog
-* Fri Sep 21 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.1.2-1
+* Fri Oct 19 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.1.2-1
- Updated to upstream version 2.1.2
-- Require php-common ">= 5.3.3" instead of ">= 5.3.2"
+- PHP minimum version 5.3.3 instead of 5.3.2
- Added php-json and php-reflection requires
+- Added PEAR package.xml modifications
+- Added patch for tests' bootstrap.php
+- Added tests (%%check)
* Sat Sep 15 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.0.17-1
- Updated to upstream version 2.0.17
diff --git a/tests-bootstrap.patch b/tests-bootstrap.patch
new file mode 100644
index 0000000..628d060
--- /dev/null
+++ b/tests-bootstrap.patch
@@ -0,0 +1,24 @@
+--- Symfony/Component/Console/Tests/bootstrap.php 2012-09-20 03:42:07.000000000 -0400
++++ Symfony/Component/Console/Tests/bootstrap.php 2012-10-19 22:33:02.295207910 -0400
+@@ -10,9 +10,18 @@
+ */
+
+ spl_autoload_register(function ($class) {
+- if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Console')) {
+- if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Console')).'.php')) {
+- require_once $file;
++ if (0 === strpos(ltrim($class, '/'), 'Symfony\Component')) {
++ $file = substr(str_replace('\\', '/', $class), strlen('Symfony\Component')).'.php';
++ if (file_exists(__DIR__.'/../..'.$file)) {
++ // Load from source tree
++ require_once __DIR__.'/../..'.$file;
++ } else {
++ try {
++ // Try loading from incude path
++ require_once 'Symfony/Component'.$file;
++ } catch (Exception $e) {
++ // Fail silently so class not found fatal error still raised
++ }
+ }
+ }
+ });
More information about the scm-commits
mailing list