[php-symfony2-HttpFoundation] Added tests

Shawn Iwinski siwinski at fedoraproject.org
Sat Oct 20 16:40:23 UTC 2012


commit 28aff664df3d54835a747a4538aa82cfe3897682
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sat Oct 20 12:39:59 2012 -0400

    Added tests

 .gitignore                       |    1 +
 php-symfony2-HttpFoundation.spec |   49 ++++++++++++++++++++++++++++++++++---
 sources                          |    1 +
 tests-bootstrap.patch            |   26 ++++++++++++++++++++
 4 files changed, 73 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a6c3091..e4b8ed5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 /HttpFoundation-2.0.15.tgz
 /HttpFoundation-2.0.16.tgz
 /HttpFoundation-2.0.17.tgz
+/HttpFoundation-2.1.2.tgz
diff --git a/php-symfony2-HttpFoundation.spec b/php-symfony2-HttpFoundation.spec
index 3730956..461341b 100644
--- a/php-symfony2-HttpFoundation.spec
+++ b/php-symfony2-HttpFoundation.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-HttpFoundation
 Version:          2.1.2
@@ -12,12 +13,28 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/doc/current/components/http_foundation/index.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})
-
-Requires:         php-common >= 5.3.3
+# Test requires
+BuildRequires:    php-common >= %{php_min_ver}
+BuildRequires:    php-pear(pear.phpunit.de/PHPUnit)
+# Test requires: phpci
+BuildRequires:    php-date
+BuildRequires:    php-fileinfo
+BuildRequires:    php-json
+BuildRequires:    php-pcre
+BuildRequires:    php-pdo
+BuildRequires:    php-reflection
+BuildRequires:    php-session
+BuildRequires:    php-sockets
+BuildRequires:    php-spl
+# Test requires: phpci dist specific requires
+%{?fedora:BuildRequires: php-filter}
+
+Requires:         php-common >= %{php_min_ver}
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
 Requires(post):   %{__pear}
@@ -53,6 +70,21 @@ Optional dependencies: memcache, memcached, mongo
 
 %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
 
@@ -73,6 +105,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 || :
@@ -91,15 +128,19 @@ 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
+* Sat Oct 20 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, php-reflection and php-filter requires
 - Removed php-hash require
 - Updated description with optional dependencies
+- 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/sources b/sources
index 1dbf34f..ee17423 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 75c65ff4fb5e9d4cfc6ebc19d2092eeb  HttpFoundation-2.0.15.tgz
 d2b2332af81087136a0867e7cfe4fd48  HttpFoundation-2.0.16.tgz
 72d9801da0caf0516106f877b8082b31  HttpFoundation-2.0.17.tgz
+b16d42b449f1ea8b0f31f1e5fd735741  HttpFoundation-2.1.2.tgz
diff --git a/tests-bootstrap.patch b/tests-bootstrap.patch
new file mode 100644
index 0000000..e282092
--- /dev/null
+++ b/tests-bootstrap.patch
@@ -0,0 +1,26 @@
+--- Symfony/Component/HttpFoundation/Tests/bootstrap.php	2012-09-20 03:42:11.000000000 -0400
++++ Symfony/Component/HttpFoundation/Tests/bootstrap.php	2012-10-20 12:10:08.134941397 -0400
+@@ -14,9 +14,21 @@
+         require_once __DIR__.'/../Resources/stubs/SessionHandlerInterface.php';
+     }
+ 
+-    if (0 !== strpos(ltrim($class, '/'), 'Symfony\Component\HttpFoundation')) {
++    if (0 !== strpos(ltrim($class, '/'), 'Symfony\Component')) {
+         return;
+     }
+ 
+-    require_once __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\HttpFoundation')).'.php';
++    $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