diff options
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | php-goutte-pull-request-290.patch | 31 | ||||
-rw-r--r-- | php-goutte.spec | 88 |
3 files changed, 74 insertions, 47 deletions
diff --git a/composer.json b/composer.json index a5d3d66..d99e280 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } } } diff --git a/php-goutte-pull-request-290.patch b/php-goutte-pull-request-290.patch new file mode 100644 index 0000000..04e859a --- /dev/null +++ b/php-goutte-pull-request-290.patch @@ -0,0 +1,31 @@ +From c990361e61467c4f4a7ff4f08d3cd6d7c6cd784d Mon Sep 17 00:00:00 2001 +From: Shawn Iwinski <siwinski@redhat.com> +Date: Fri, 30 Dec 2016 14:19:53 -0500 +Subject: [PATCH] Fix tests after #246 was merged (header case normalization) + +--- + Goutte/Tests/ClientTest.php | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Goutte/Tests/ClientTest.php b/Goutte/Tests/ClientTest.php +index b5b8583..4a633e4 100644 +--- a/Goutte/Tests/ClientTest.php ++++ b/Goutte/Tests/ClientTest.php +@@ -380,7 +380,7 @@ public function testResetHeaders() + + $reflectionProperty = new \ReflectionProperty('Goutte\Client', 'headers'); + $reflectionProperty->setAccessible(true); +- $this->assertEquals(array('X-Test' => 'test'), $reflectionProperty->getValue($client)); ++ $this->assertEquals(array('x-test' => 'test'), $reflectionProperty->getValue($client)); + + $client->resetHeaders(); + $this->assertEquals([], $reflectionProperty->getValue($client)); +@@ -394,7 +394,7 @@ public function testRestart() + + $headersReflectionProperty = new \ReflectionProperty('Goutte\Client', 'headers'); + $headersReflectionProperty->setAccessible(true); +- $this->assertEquals(array('X-Test' => 'test'), $headersReflectionProperty->getValue($client)); ++ $this->assertEquals(array('x-test' => 'test'), $headersReflectionProperty->getValue($client)); + + $authReflectionProperty = new \ReflectionProperty('Goutte\Client', 'auth'); + $authReflectionProperty->setAccessible(true); diff --git a/php-goutte.spec b/php-goutte.spec index cb513ae..4b02c90 100644 --- a/php-goutte.spec +++ b/php-goutte.spec @@ -12,8 +12,8 @@ %global github_owner FriendsOfPHP %global github_name Goutte -%global github_version 3.1.2 -%global github_commit 3cbc6ed222422a28400e470050f14928a153207e +%global github_version 3.2.0 +%global github_commit 8cc89de5e71daf84051859616891d3320d88a9e8 %global composer_vendor fabpot %global composer_project goutte @@ -45,6 +45,10 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# Fix tests after #246 was merged (header case normalization) +# https://patch-diff.githubusercontent.com/raw/FriendsOfPHP/Goutte/pull/290.patch +Patch0: %{name}-pull-request-290.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests @@ -57,10 +61,10 @@ BuildRequires: php-composer(guzzlehttp/guzzle) >= %{guzzle_min_ver} BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver} BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} -## phpcompatinfo (computed from version 3.1.2) -# <none> +## phpcompatinfo (computed from version 3.2.0) +BuildRequires: php-reflection ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -73,8 +77,10 @@ Requires: php-composer(symfony/css-selector) < %{symfony_max_ver} Requires: php-composer(symfony/css-selector) >= %{symfony_min_ver} Requires: php-composer(symfony/dom-crawler) < %{symfony_max_ver} Requires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} -# phpcompatinfo (computed from version 3.1.2) +# phpcompatinfo (computed from version 3.2.0) # <none> +# Autoloader +Requires: php-composer(fedora/autoloader) # Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} @@ -93,40 +99,31 @@ Autoloader: %{phpdir}/Goutte/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +: Fix tests after #246 was merged (header case normalization) +%patch0 -p1 + + +%build : Create autoloader cat <<'AUTOLOAD' | tee Goutte/autoload.php <?php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('Goutte\\', dirname(__DIR__)); +\Fedora\Autoloader\Autoload::addPsr4('Goutte\\', __DIR__); -require_once '%{phpdir}/GuzzleHttp6/autoload.php'; -require_once '%{phpdir}/Symfony/Component/BrowserKit/autoload.php'; -require_once '%{phpdir}/Symfony/Component/CssSelector/autoload.php'; -require_once '%{phpdir}/Symfony/Component/DomCrawler/autoload.php'; - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required([ + '%{phpdir}/GuzzleHttp6/autoload.php', + '%{phpdir}/Symfony/Component/BrowserKit/autoload.php', + '%{phpdir}/Symfony/Component/CssSelector/autoload.php', + '%{phpdir}/Symfony/Component/DomCrawler/autoload.php', +]); AUTOLOAD -%build -# Empty build section, nothing required - - %install rm -rf %{buildroot} @@ -136,24 +133,18 @@ cp -p Goutte/{autoload,Client}.php %{buildroot}/%{phpdir}/Goutte/ %check %if %{with_tests} - -ret=0 -run=0 -if which php56; then - php56 %{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php -fi -exit $ret +BOOTSTRAP=%{buildroot}/%{phpdir}/Goutte/autoload.php + +%{_bindir}/phpunit --verbose --bootstrap $BOOTSTRAP + +: Upstream tests with SCLs if available +SCL_RETURN_CODE=0 +for SCL in php56 php70 php71; do + if which $SCL; then + $SCL %{_bindir}/phpunit --verbose --bootstrap $BOOTSTRAP || SCL_RETURN_CODE=1 + fi +done +exit $SCL_RETURN_CODE %else : Tests skipped %endif @@ -173,6 +164,11 @@ rm -rf %{buildroot} %changelog +* Fri Dec 30 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 3.2.0-1 +- Updated to 3.2.0 (RHBZ #1395456) +- Use php-composer(fedora/autoloader) +- Run upstream tests with SCLs if they are available + * Sat Jul 09 2016 Shawn Iwinski <shawn@iwin.ski> - 3.1.2-1 - Update to 3.1.2 (RHBZ #1100719, 1289798) |