[php-symfony2-BrowserKit] Updated to upstream version 2.1.2 + added tests

Shawn Iwinski siwinski at fedoraproject.org
Wed Oct 24 11:10:44 UTC 2012


commit 7f5be75ad049d70d9f5f5d584d634f5cc0dc82b1
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sat Sep 22 00:29:45 2012 -0400

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                    |    1 +
 php-symfony2-BrowserKit-tests-bootstrap.patch |   24 +++++++++
 php-symfony2-BrowserKit.spec                  |   64 ++++++++++++++++++++++--
 sources                                       |    1 +
 4 files changed, 84 insertions(+), 6 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d53dc34..f3c7c16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /BrowserKit-2.0.15.tgz
 /BrowserKit-2.0.16.tgz
 /BrowserKit-2.0.17.tgz
+/BrowserKit-2.1.2.tgz
diff --git a/php-symfony2-BrowserKit-tests-bootstrap.patch b/php-symfony2-BrowserKit-tests-bootstrap.patch
new file mode 100644
index 0000000..5f29b54
--- /dev/null
+++ b/php-symfony2-BrowserKit-tests-bootstrap.patch
@@ -0,0 +1,24 @@
+--- Symfony/Component/BrowserKit/Tests/bootstrap.php	2012-09-20 03:42:06.000000000 -0400
++++ Symfony/Component/BrowserKit/Tests/bootstrap.php	2012-10-23 21:50:47.317731671 -0400
+@@ -10,9 +10,18 @@
+  */
+ 
+ spl_autoload_register(function ($class) {
+-    if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\BrowserKit')) {
+-        if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\BrowserKit')).'.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
++            }
+         }
+     }
+ });
diff --git a/php-symfony2-BrowserKit.spec b/php-symfony2-BrowserKit.spec
index e6fd908..831b325 100644
--- a/php-symfony2-BrowserKit.spec
+++ b/php-symfony2-BrowserKit.spec
@@ -2,9 +2,10 @@
 
 %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-BrowserKit
-Version:          2.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,32 +13,67 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/components
 Source0:          http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
+Patch0:           %{name}-tests-bootstrap.patch
 
 BuildArch:        noarch
+
 BuildRequires:    php-pear(PEAR)
 BuildRequires:    php-channel(%{pear_channel})
-
-Requires:         php-common >= 5.3.2
+# Test requires
+BuildRequires:    php-common >= %{php_min_ver}
+BuildRequires:    php-pear(pear.phpunit.de/PHPUnit)
+BuildRequires:    php-pear(%{pear_channel}/CssSelector) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/DomCrawler) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Process) >= 2.1.0
+# Test requires: phpci
+BuildRequires:    php-date
+BuildRequires:    php-pcre
+BuildRequires:    php-reflection
+BuildRequires:    php-spl
+
+Requires:         php-common >= 5.3.3
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
-Requires:         php-pear(%{pear_channel}/DomCrawler) = %{version}
+Requires:         php-pear(%{pear_channel}/DomCrawler) >= 2.1.0
 Requires(post):   %{__pear}
 Requires(postun): %{__pear}
 # phpci requires
 Requires:         php-date
 Requires:         php-pcre
+Requires:         php-reflection
 Requires:         php-spl
 # Optional requires
-Requires:         php-pear(%{pear_channel}/Process) = %{version}
+Requires:         php-pear(%{pear_channel}/Process) >= 2.1.0
 
 Provides:         php-pear(%{pear_channel}/%{pear_name}) = %{version}
 
 %description
-%{summary}.
+BrowserKit simulates the behavior of a web browser.
+
+The component only provides an abstract client and does not provide any
+"default" back-end for the HTTP layer.
 
 
 %prep
 %setup -q -c
+
+# Patches
+cd %{pear_name}-%{version}
+%patch0 -p0
+cd ..
+
+# Modify PEAR package.xml file:
+# - Remove .gitignore file
+# - Change role from "php" to "doc" for CHANGELOG.md file
+# - Change role from "php" to "test" for all test files
+# - Remove md5sum from bootsrap.php file since it was patched
+sed -e '/.gitignore/d' \
+    -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
 
@@ -58,6 +94,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 || :
@@ -74,9 +115,20 @@ fi
 %doc %{pear_docdir}/%{pear_name}
 %{pear_xmldir}/%{name}.xml
 %{pear_phpdir}/Symfony/Component/%{pear_name}
+%{pear_testdir}/%{pear_name}
 
 
 %changelog
+* Wed Oct 24 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.1.2-1
+- Updated to upstream version 2.1.2
+- Updated description
+- PHP minimum version 5.3.3 instead of 5.3.2
+- Require other components ">= 2.1.0" instead of "= %%{version}"
+- Added php-reflection, CssSelector and Process 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
 - Added php-spl require
diff --git a/sources b/sources
index e5d4b86..3d722da 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 b09bc7c02f2e6b36453d3fda32a494ec  BrowserKit-2.0.15.tgz
 1b586f6a0509eec16a325c2f01d26cd5  BrowserKit-2.0.16.tgz
 910219ecd74f060cc3bc7023c672e3af  BrowserKit-2.0.17.tgz
+e6bea847e4abe4c86d86c48e3567e62d  BrowserKit-2.1.2.tgz


More information about the scm-commits mailing list