summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-10-21 15:29:25 +0200
committerRemi Collet <fedora@famillecollet.com>2016-10-21 15:29:25 +0200
commita7291ea90d4d013385eb5f0eee58c7221a8fb0fb (patch)
tree595795fde1e5dc36c4cc05e59b6b021cf687e00a
parent6b9c01439a5cb45d57b6f39cf347851b7310aa0f (diff)
php-fedora-autoloader: 0.1.2
-rw-r--r--php-fedora-autoloader-upstream.patch146
-rw-r--r--php-fedora-autoloader.spec13
2 files changed, 6 insertions, 153 deletions
diff --git a/php-fedora-autoloader-upstream.patch b/php-fedora-autoloader-upstream.patch
deleted file mode 100644
index eb62aa6..0000000
--- a/php-fedora-autoloader-upstream.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 5b810402b041e69f67ad6b88d65f30e11a5b6683 Mon Sep 17 00:00:00 2001
-From: Remi Collet <fedora@famillecollet.com>
-Date: Fri, 21 Oct 2016 14:59:02 +0200
-Subject: [PATCH] Handle namespaced classes with PSR-0, fix #5
-
----
- src/Autoload.php | 9 ++++-----
- tests/AutoloadTest.php | 35 +++++++++++++++++++++++++++++++++++
- 2 files changed, 39 insertions(+), 5 deletions(-)
-
-diff --git a/src/Autoload.php b/src/Autoload.php
-index 74e86cf..5d08c84 100644
---- a/src/Autoload.php
-+++ b/src/Autoload.php
-@@ -251,11 +251,11 @@ public static function findFile($class)
- // PSR-0
- if (count(static::$psr0)) {
- $pos = strrpos($class, '\\');
-- $file = '';
-+ $file = $namespace = '';
- if ($pos) {
-- $namespace = substr($class, 0, $pos);
-+ $namespace = substr($class, 0, $pos + 1);
- $class = substr($class, $pos + 1);
-- $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR;
-+ $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
- }
- $file .= str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
-
-@@ -263,8 +263,7 @@ public static function findFile($class)
- // for PHP < 5.5 compatibility.
- foreach (static::$psr0 as $psr0) {
- list($prefix, $path) = $psr0;
--
-- if (empty($prefix) || 0 === strpos($class, $prefix)) {
-+ if (empty($prefix) || 0 === strpos($namespace.$class, $prefix)) {
- if (file_exists($path.$file)) {
- return $path.$file;
- }
-diff --git a/tests/AutoloadTest.php b/tests/AutoloadTest.php
-index e1e2783..087682c 100644
---- a/tests/AutoloadTest.php
-+++ b/tests/AutoloadTest.php
-@@ -14,6 +14,7 @@
- class AutoloadTest extends \PHPUnit_Framework_TestCase
- {
- /**
-+ * @group psr4
- * @covers Fedora::Autoloader::Autoload::addPsr4
- **/
- public function testAddPsr4()
-@@ -24,6 +25,7 @@ public function testAddPsr4()
- }
-
- /**
-+ * @group psr4
- * @covers Fedora::Autoloader::Autoload::addPsr4
- **/
- public function testAddPsr4Order()
-@@ -37,6 +39,7 @@ public function testAddPsr4Order()
- }
-
- /**
-+ * @group classmap
- * @covers Fedora::Autoloader::Autoload::addClassMap
- **/
- public function testAddClassMap()
-@@ -52,6 +55,7 @@ public function testAddClassMap()
- }
-
- /**
-+ * @group classmap
- * @covers Fedora::Autoloader::Autoload::addClassMap
- **/
- public function testAddClassMapTemplate()
-@@ -62,6 +66,7 @@ public function testAddClassMapTemplate()
- }
-
- /**
-+ * @group classmap
- * @covers Fedora::Autoloader::Autoload::addClassMap
- **/
- public function testAddClassMapLowerCase()
-@@ -72,6 +77,7 @@ public function testAddClassMapLowerCase()
- }
-
- /**
-+ * @group classmap
- * @covers Fedora::Autoloader::Autoload::addClassMap
- **/
- public function testAddClassMapTemplateOrder()
-@@ -85,6 +91,7 @@ public function testAddClassMapTemplateOrder()
- }
-
- /**
-+ * @group classmap
- * @covers Fedora::Autoloader::Autoload::addClassMap
- **/
- public function testAddClassMapTemplateOrderBis()
-@@ -104,6 +111,7 @@ public function testAddClassMapTemplateOrderBis()
- }
-
- /**
-+ * @group psr0
- * @covers Fedora::Autoloader::Autoload::addIncludePath
- **/
- public function testAddIncludePath()
-@@ -129,6 +137,7 @@ public function testAddIncludePath()
- }
-
- /**
-+ * @group psr0
- * @covers Fedora::Autoloader::Autoload::addPsr0
- **/
- public function testAddPsr0Simple()
-@@ -145,4 +154,30 @@ public function testAddPsr0Simple()
- $this->assertTrue(class_exists('One\\Two\\Foo'));
- $this->assertTrue(class_exists('One_Two\\Foo'));
- }
-+
-+ /**
-+ * @group psr0
-+ * @covers Fedora::Autoloader::Autoload::addPsr0
-+ **/
-+ public function testAddPsr0ns1()
-+ {
-+ $this->assertFalse(class_exists('One\\Two\\Foo'));
-+
-+ Autoload::addPsr0('One\\', __DIR__.'/fixtures/PSR0');
-+
-+ $this->assertTrue(class_exists('One\\Two\\Foo'));
-+ }
-+
-+ /**
-+ * @group psr0
-+ * @covers Fedora::Autoloader::Autoload::addPsr0
-+ **/
-+ public function testAddPsr0ns2()
-+ {
-+ $this->assertFalse(class_exists('One\\Two\\Foo'));
-+
-+ Autoload::addPsr0('One\\Two\\', __DIR__.'/fixtures/PSR0');
-+
-+ $this->assertTrue(class_exists('One\\Two\\Foo'));
-+ }
- }
diff --git a/php-fedora-autoloader.spec b/php-fedora-autoloader.spec
index 0e7e6a1..5779165 100644
--- a/php-fedora-autoloader.spec
+++ b/php-fedora-autoloader.spec
@@ -13,8 +13,8 @@
%global github_owner php-fedora
%global github_name autoloader
-%global github_version 0.1.1
-%global github_commit 816e4e59061c592f7480a00c6cd9c16067811c1e
+%global github_version 0.1.2
+%global github_commit 35f7b52f4682276620369bc4bc1a3a5fef93faad
%global composer_vendor fedora
%global composer_project autoloader
@@ -33,7 +33,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 2%{?github_release}%{?dist}
+Release: 1%{?github_release}%{?dist}
Summary: Fedora Autoloader
Group: Development/Libraries
@@ -41,8 +41,6 @@ License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
-Patch0: %{name}-upstream.patch
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
@@ -93,8 +91,6 @@ Provides needed tools to build other packages:
%prep
%setup -qn %{github_name}-%{github_commit}
-%patch0 -p1 -b .pr6
-
: Set PHP directory in phpab template
sed "s#___AUTOLOAD_PATH___#'%{phpdir}/Fedora/Autoloader'#" \
-i res/phpab/fedora.php.tpl
@@ -162,6 +158,9 @@ rm -rf %{buildroot}
%changelog
+* Fri Oct 21 2016 Remi Collet <remi@fedoraproject.org> - 0.1.2-1
+- update to 0.1.2
+
* Fri Oct 21 2016 Remi Collet <remi@remirepo.net> - 0.1.1-2
- test build for PR #6