From 210bc72aa28834ac763c27bfc458d2286390fb80 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 5 Aug 2016 11:32:28 +0200 Subject: php-nette: cleanup test suite --- php-nette-database-dev.spec | 16 ++++++++-------- php-nette-database-upstream.patch | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 php-nette-database-upstream.patch diff --git a/php-nette-database-dev.spec b/php-nette-database-dev.spec index 2c73826..a8d444c 100644 --- a/php-nette-database-dev.spec +++ b/php-nette-database-dev.spec @@ -34,6 +34,8 @@ Source0: %{name}-%{version}-%{gh_short}.tgz # pull a git snapshot to get test sutie Source1: makesrc.sh +Patch0: %{name}-upstream.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php-composer(theseer/autoload) @@ -97,6 +99,8 @@ To use this library, you just have to add, in your project: %prep %setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 + %build : Generate a classmap autoloader @@ -117,8 +121,6 @@ cp -pr src/* %{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 %if 0%{?rhel} != 5 @@ -140,21 +142,19 @@ require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php'; EOF : Run test suite in sources tree -# remirepo:13 +# remirepo:11 ret=0 run=0 if which php56; then - cat /opt/remi/php56/root/etc/php.ini /opt/remi/php56/root/etc/php.d/*ini >php.ini - php56 %{_bindir}/nette-tester --colors 0 -p php56 -c ./php.ini tests -s || ret=1 + php56 %{_bindir}/nette-tester --colors 0 -p php56 -C tests -s || ret=1 run=1 fi if which php71; then - cat /etc/opt/remi/php71/php.ini /etc/opt/remi/php71/php.d/*ini >php.ini - php71 %{_bindir}/nette-tester --colors 0 -p php71 -c ./php.ini tests -s || ret=1 + php71 %{_bindir}/nette-tester --colors 0 -p php71 -C tests -s || ret=1 run=1 fi if [ $run -eq 0 ]; then -%{_bindir}/nette-tester --colors 0 -p php -c ./php.ini tests -s +%{_bindir}/nette-tester --colors 0 -p php -C tests -s # remirepo:2 fi exit $ret diff --git a/php-nette-database-upstream.patch b/php-nette-database-upstream.patch new file mode 100644 index 0000000..e11bcd1 --- /dev/null +++ b/php-nette-database-upstream.patch @@ -0,0 +1,25 @@ +From 9e7a1dcd9dc482366a52cf328bdb441faf451dad Mon Sep 17 00:00:00 2001 +From: David Grudl +Date: Thu, 21 Jul 2016 13:40:08 +0200 +Subject: [PATCH] tests: fixed compatibility with PHP 7.1 + +https://wiki.php.net/rfc/invalid_strings_in_arithmetic +--- + tests/Database/Table/Selection.page().phpt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/Database/Table/Selection.page().phpt b/tests/Database/Table/Selection.page().phpt +index 2550625..96b13bd 100644 +--- a/tests/Database/Table/Selection.page().phpt ++++ b/tests/Database/Table/Selection.page().phpt +@@ -60,8 +60,8 @@ test(function () use ($context) { //less items than $itemsPerPage + + // SQL Server throw PDOException 'The number of rows provided for a FETCH clause must be greater then zero.' + if ($driverName !== 'sqlsrv') { +- test(function () use ($context) { //invalid params ++ Assert::error(function () use ($context) { //invalid params + $tags = $context->table('tag')->page('foo', 'bar'); + Assert::equal(0, count($tags)); //no items +- }); ++ }, PHP_VERSION_ID >= 70100 ? [[E_WARNING, 'A non-numeric value encountered']] : []); + } -- cgit