summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-02-16 15:32:55 +0100
committerRemi Collet <fedora@famillecollet.com>2017-02-16 15:32:55 +0100
commit83ac416483d249029bff10387d154d7748d3eafa (patch)
tree1e8c7784ff1cabadcccec0aa3c7ca51f54c72992
parentc27adbff7d45f3c991532f1c4d8414521b56015a (diff)
php-Faker: 1.6.0
-rw-r--r--composer.json35
-rw-r--r--php-Faker-upstream.patch57
-rw-r--r--php-Faker.spec91
3 files changed, 136 insertions, 47 deletions
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..1bf3497
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,35 @@
+{
+ "name": "fzaninotto/faker",
+ "type": "library",
+ "description": "Faker is a PHP library that generates fake data for you.",
+ "keywords": ["faker", "fixtures", "data"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "François Zaninotto"
+ }
+ ],
+ "require": {
+ "php": "^5.3.3|^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~1.5",
+ "ext-intl": "*"
+ },
+ "autoload": {
+ "psr-4": {
+ "Faker\\": "src/Faker/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Faker\\Test\\": "test/Faker/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6.0"
+ }
+ }
+}
diff --git a/php-Faker-upstream.patch b/php-Faker-upstream.patch
new file mode 100644
index 0000000..bda2a97
--- /dev/null
+++ b/php-Faker-upstream.patch
@@ -0,0 +1,57 @@
+From 19dcb9039ec3df9776af23aebd9de5c8d0de3946 Mon Sep 17 00:00:00 2001
+From: oittaa <oittaa@users.noreply.github.com>
+Date: Thu, 6 Oct 2016 23:59:25 +0300
+Subject: [PATCH] [UuidTest.php] Don't use mt_srand() directly.
+
+---
+ test/Faker/Provider/UuidTest.php | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/test/Faker/Provider/UuidTest.php b/test/Faker/Provider/UuidTest.php
+index fceb8df..22f9efb 100644
+--- a/test/Faker/Provider/UuidTest.php
++++ b/test/Faker/Provider/UuidTest.php
+@@ -2,6 +2,7 @@
+
+ namespace Faker\Test\Provider;
+
++use Faker\Generator;
+ use Faker\Provider\Uuid as BaseProvider;
+
+ class UuidTest extends \PHPUnit_Framework_TestCase
+@@ -14,7 +15,8 @@ public function testUuidReturnsUuid()
+
+ public function testUuidExpectedSeed()
+ {
+- mt_srand(123);
++ $faker = new Generator();
++ $faker->seed(123);
+ $this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid());
+ $this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid());
+ }
+From 89135d0fe594ec7f3e82ef084242df09b88f6fd8 Mon Sep 17 00:00:00 2001
+From: oittaa <oittaa@users.noreply.github.com>
+Date: Thu, 6 Oct 2016 23:32:59 +0300
+Subject: [PATCH] [Generator.php] mt_rand() changed in PHP 7.1
+
+---
+ src/Faker/Generator.php | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/Faker/Generator.php b/src/Faker/Generator.php
+index cb13cd0..9496bca 100644
+--- a/src/Faker/Generator.php
++++ b/src/Faker/Generator.php
+@@ -188,7 +188,11 @@ public function seed($seed = null)
+ if ($seed === null) {
+ mt_srand();
+ } else {
+- mt_srand((int) $seed);
++ if (PHP_VERSION_ID < 70100) {
++ mt_srand((int) $seed);
++ } else {
++ mt_srand((int) $seed, MT_RAND_PHP);
++ }
+ }
+ }
+
diff --git a/php-Faker.spec b/php-Faker.spec
index abff111..e7726f6 100644
--- a/php-Faker.spec
+++ b/php-Faker.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-Faker
#
-# Copyright (c) 2012-2016 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2012-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,13 +12,13 @@
%global github_owner fzaninotto
%global github_name Faker
-%global github_version 1.5.0
-%global github_commit d0190b156bcca848d401fb80f31f504f37141c8d
+%global github_version 1.6.0
+%global github_commit 44f9a286a04b80c76a4e5fb7aad8bb539b920123
%global composer_vendor fzaninotto
%global composer_project faker
-# "php": ">=5.3.3"
+# "php": "^5.3.3|^7.0"
%global php_min_ver 5.3.3
# Build using "--without tests" to disable tests
@@ -28,7 +28,7 @@
Name: php-%{github_name}
Version: %{github_version}
-Release: 5%{?dist}
+Release: 1%{?dist}
Summary: A PHP library that generates fake data
Group: Development/Libraries
@@ -36,6 +36,9 @@ License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+# For PHP 7.1
+Patch0: %{name}-upstream.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
@@ -43,25 +46,24 @@ BuildArch: noarch
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
-## phpcompatinfo (computed from version 1.5.0)
+BuildRequires: php-intl
+## phpcompatinfo (computed from version 1.6.0)
+BuildRequires: php-ctype
BuildRequires: php-curl
BuildRequires: php-date
BuildRequires: php-filter
BuildRequires: php-hash
-BuildRequires: php-intl
BuildRequires: php-mbstring
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
## Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-fedora-autoloader-devel
%endif
# composer.json
Requires: php(language) >= %{php_min_ver}
-# composer.json: optional
-Requires: php-intl
-# phpcompatinfo (computed from version 1.5.0)
+# phpcompatinfo (computed from version 1.6.0)
Requires: php-curl
Requires: php-date
Requires: php-hash
@@ -70,11 +72,7 @@ Requires: php-pcre
Requires: php-reflection
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
-# Weak dependencies
-%if 0%{?fedora} >= 21
-Suggests: php-composer(doctrine/orm)
-%endif
+Requires: php-composer(fedora/autoloader)
# php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}
Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
@@ -103,15 +101,9 @@ Optional:
%prep
%setup -qn %{github_name}-%{github_commit}
+%patch0 -p1 -b .upstream
-: Remove executable bits
-: https://github.com/fzaninotto/Faker/pull/593
-chmod a-x \
- src/Faker/Provider/sl_SI/Address.php \
- src/Faker/Provider/sl_SI/Internet.php \
- src/Faker/Provider/sl_SI/Payment.php \
- src/Faker/Provider/sl_SI/PhoneNumber.php \
- test/Faker/Provider/ja_JP/PersonTest.php
+find src -name \*upstream -exec rm {} \;
: Create autoloader
cat <<'AUTOLOAD' | tee src/Faker/autoload.php
@@ -123,18 +115,9 @@ cat <<'AUTOLOAD' | tee src/Faker/autoload.php
* @return \Symfony\Component\ClassLoader\ClassLoader
*/
-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('Faker\\', dirname(__DIR__));
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Faker\\', __DIR__);
-return $fedoraClassLoader;
AUTOLOAD
@@ -149,22 +132,32 @@ cp -rp src/%{github_name} %{buildroot}%{phpdir}/
%check
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require_once '%{buildroot}%{phpdir}/Faker/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('Faker\\Test\\', dirname(__DIR__).'/test/Faker');
+EOF
+
%if %{with_tests}
: Skip tests that require downloading content
-sed 's/function testDownloadWithDefaults/function SKIP_testDownloadWithDefaults/' \
+sed -e 's/function testDownloadWithDefaults/function SKIP_testDownloadWithDefaults/' \
-i test/Faker/Provider/ImageTest.php
+: Skip bad test see https://github.com/fzaninotto/Faker/issues/1146
+sed -e 's/func testIpv4NotLocalNetwork/func SKIP_testIpv4NotLocalNetwork/' \
+ -i test/Faker/Provider/InternetTest.php
: Skip tests with erratic results in Koschei
-sed -e '/561059108101825/d' \
- -e '/601100099013942/d' \
- -i test/Faker/Calculator/LuhnTest.php
-
-%{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}%{phpdir}/Faker/autoload.php
-
-if which php70; then
- php70 %{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}%{phpdir}/Faker/autoload.php
-fi
+#sed -e '/561059108101825/d' \
+# -e '/601100099013942/d' \
+# -i test/Faker/Calculator/LuhnTest.php
+
+ret=0
+for cmd in php56 php70 php71 php; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit --verbose || ret=1
+ fi
+done
+exit $ret
%else
: Tests skipped
%endif
@@ -183,6 +176,10 @@ rm -rf %{buildroot}
%changelog
+* Thu Feb 16 2017 Remi Collet <remi@remirepo.net> - 1.6.0-1
+- update to 1.6.0
+- switch to fedora/autoloader
+
* Sat Mar 12 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-5
- Add standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" provides
- Updated autoloader