From 2b435b9a79b86e750ceee26645ea26391795336b Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 4 Aug 2016 16:23:03 +0200
Subject: php-kdyby-events: 3.0.2

---
 composer.json                  |  4 ++--
 makesrc.sh                     | 10 +++++-----
 php-kdyby-events-tester2.patch | 10 ++++++++++
 php-kdyby-events.spec          | 36 ++++++++++++++++++++++++++----------
 4 files changed, 43 insertions(+), 17 deletions(-)
 create mode 100644 php-kdyby-events-tester2.patch

diff --git a/composer.json b/composer.json
index 591500b..6ed83ee 100644
--- a/composer.json
+++ b/composer.json
@@ -43,7 +43,7 @@
 		"tracy/tracy": "~2.3@dev",
 		"nette/utils": "~2.3@dev",
 
-		"symfony/event-dispatcher": "~2.3",
+		"symfony/event-dispatcher": "~2.3|~3.0",
 
 		"nette/tester": "~1.4"
 	},
@@ -60,7 +60,7 @@
 	},
 	"extra": {
 		"branch-alias": {
-			"dev-master": "2.4-dev"
+			"dev-master": "3.0-dev"
 		}
 	}
 }
diff --git a/makesrc.sh b/makesrc.sh
index 87d223d..2070e27 100755
--- a/makesrc.sh
+++ b/makesrc.sh
@@ -1,10 +1,10 @@
 #!/bin/bash
 
 NAME=$(basename $PWD)
-OWNER=$(sed   -n '/^%global gh_owner/{s/.* //;p}'   $NAME.spec)
-PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
-VERSION=$(sed -n '/^Version:/{s/.* //;p}'           $NAME.spec)
-COMMIT=$(sed  -n '/^%global gh_commit/{s/.* //;p}'  $NAME.spec)
+OWNER=$(sed   -n '/^%global gh_owner/{s/.* //;p}'   $NAME$1.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME$1.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}'           $NAME$1.spec)
+COMMIT=$(sed  -n '/^%global gh_commit/{s/.* //;p}'  $NAME$1.spec)
 SHORT=${COMMIT:0:7}
 
 echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
@@ -16,7 +16,7 @@ git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
 echo "Getting commit..."
 pushd $PROJECT-$COMMIT
 git checkout $COMMIT
-cp composer.json ../composer.json
+cp composer.json ../composer$1.json
 popd
 
 echo "Archiving..."
diff --git a/php-kdyby-events-tester2.patch b/php-kdyby-events-tester2.patch
new file mode 100644
index 0000000..8c2a31c
--- /dev/null
+++ b/php-kdyby-events-tester2.patch
@@ -0,0 +1,10 @@
+diff -up tests/KdybyTests/bootstrap.php.old tests/KdybyTests/bootstrap.php
+--- tests/KdybyTests/bootstrap.php.old	2016-08-04 16:10:59.039641276 +0200
++++ tests/KdybyTests/bootstrap.php	2016-08-04 16:11:04.206667988 +0200
+@@ -33,5 +33,5 @@ function id($val) {
+ }
+ 
+ function run(Tester\TestCase $testCase) {
+-	$testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);
++	$testCase->run();
+ }
diff --git a/php-kdyby-events.spec b/php-kdyby-events.spec
index a45025d..63bf4e2 100644
--- a/php-kdyby-events.spec
+++ b/php-kdyby-events.spec
@@ -6,7 +6,7 @@
 #
 # Please, preserve the changelog entries
 #
-%global gh_commit    d8a0e8a64a59f501996f8f9591aa3f950208f091
+%global gh_commit    05de56c633167ed218939cfc8cdff984d78c0d9c
 #global gh_date      20150728
 %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
 %global gh_owner     kdyby
@@ -17,7 +17,7 @@
 %global with_tests   0%{!?_without_tests:1}
 
 Name:           php-%{gh_owner}-%{gh_project}
-Version:        2.4.1
+Version:        3.0.2
 %global specrel 1
 Release:        %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist}
 Summary:        Events for Nette Framework
@@ -31,6 +31,10 @@ Source1:        makesrc.sh
 # Autoloader
 Source2:        %{name}-autoload.php
 
+# see https://github.com/Kdyby/Events/pull/103
+# fix for nette/tester > 2
+Patch0:         %{name}-tester2.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 %if %{with_tests}
@@ -62,7 +66,7 @@ BuildRequires:  php-composer(symfony/class-loader)
 #        "latte/latte": "~2.3@dev",
 #        "tracy/tracy": "~2.3@dev",
 #        "nette/utils": "~2.3@dev",
-#        "symfony/event-dispatcher": "~2.3",
+#        "symfony/event-dispatcher": "~2.3|~3.0",
 #        "nette/tester": "~1.4@",
 # The framework is enough as it requires everything
 BuildRequires:  php-composer(nette/nette) >= 2.3
@@ -100,6 +104,7 @@ To use this library, you just have to add, in your project:
 %setup -q -n %{gh_project}-%{gh_commit}
 
 cp %{SOURCE2} src/%{ns_vendor}/%{ns_project}/autoload.php
+%patch0 -p0 -b .tester2
 
 
 %build
@@ -114,8 +119,6 @@ cp -pr src/%{ns_vendor} %{buildroot}%{php_home}/%{ns_vendor}
 
 %check
 %if %{with_tests}
-: Generate configuration
-cat /etc/php.ini /etc/php.d/*ini >php.ini
 export LANG=fr_FR.utf8
 
 : Generate autoloader
@@ -130,12 +133,22 @@ EOF
 php -r 'require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php";'
 
 : Run test suite in sources tree
-nette-tester --colors 0 -p php -c ./php.ini tests -s
-
-if which php70; then
-  cat /etc/opt/remi/php70/php.ini /etc/opt/remi/php70/php.d/*ini >php.ini
-  php70 %{_bindir}/nette-tester --colors 0 -p php70 -c ./php.ini tests -s
+# remirepo:11
+ret=0
+run=0
+if which php56; then
+   php56 %{_bindir}/nette-tester --colors 0 -p php56 -C tests/KdybyTests -s || ret=1
+   run=1
+fi
+if which php71; then
+   php71 %{_bindir}/nette-tester --colors 0 -p php71 -C tests/KdybyTests -s || ret=1
+   run=1
 fi
+if [ $run -eq 0 ]; then
+%{_bindir}/nette-tester --colors 0 -p php -C tests/KdybyTests -s
+# remirepo:2
+fi
+exit $ret
 %else
 : Test suite disabled
 %endif
@@ -155,6 +168,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Thu Aug  4 2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-1
+- update to 3.0.2 (for nette 2.4)
+
 * Thu Apr 21 2016 Remi Collet <remi@fedoraproject.org> - 2.4.1-1
 - update to 2.4.1
 - run test suite with both PHP 5 and 7 when available
-- 
cgit