summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-07-20 11:19:03 +0200
committerRemi Collet <remi@php.net>2022-07-20 11:19:03 +0200
commit9d969e1947cf7de95011a46a864904dd6382ff40 (patch)
treeca7b27a31bd630d45ded467d61dd6ff656b87e25
parent7b63c572ebefa8ad42024e06615236edd854be14 (diff)
fix FTBFS, using upstream patch for test suite
-rw-r--r--.gitignore2
-rw-r--r--php-laminas-inputfilter-upstream.patch60
-rw-r--r--php-laminas-inputfilter.spec8
3 files changed, 69 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 1ab5c4f..01f0400 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+clog
package-*.xml
*.tgz
+*.tar.bz2
*.tar.gz
*.tar.xz
*.tar.xz.asc
diff --git a/php-laminas-inputfilter-upstream.patch b/php-laminas-inputfilter-upstream.patch
new file mode 100644
index 0000000..4372c4c
--- /dev/null
+++ b/php-laminas-inputfilter-upstream.patch
@@ -0,0 +1,60 @@
+From e9c3c54e894f623357fdf4a902250d2e86cf3def Mon Sep 17 00:00:00 2001
+From: Marco Pivetta <ocramius@gmail.com>
+Date: Wed, 20 Jul 2022 10:10:24 +0200
+Subject: [PATCH] Adjusted tests so that stubbed `ContainerInterface#has()`
+ returns `bool` instead of `null`
+
+This is necessary, as `psr/container:^2` has a stricter return type declaration, and prophecy is
+not respecting the return types upfront (unless stubbed methods are explicitly configured).
+
+While this is an upstream BC break in `psr/container:^2`, this component is not really affected
+by the BC issue, other than some stubbing being broken in it.
+
+Fixes:
+
+```
+1) LaminasTest\InputFilter\InputFilterPluginManagerFactoryTest::testFactoryConfiguresPluginManagerUnderContainerInterop with data set "input" ('Laminas\InputFilter\InputInterface')
+TypeError: Double\ContainerInterface\P8::has(): Return value must be of type bool, null returned
+2) LaminasTest\InputFilter\InputFilterPluginManagerFactoryTest::testFactoryConfiguresPluginManagerUnderContainerInterop with data set "input-filter" ('Laminas\InputFilter\InputFilt...erface')
+TypeError: Double\ContainerInterface\P8::has(): Return value must be of type bool, null returned
+```
+
+Ref: https://github.com/laminas/laminas-servicemanager/issues/146#issue-1310587609
+Ref: https://github.com/laminas/laminas-servicemanager/issues/146#issuecomment-1189956888
+---
+ test/InputFilterPluginManagerFactoryTest.php | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/test/InputFilterPluginManagerFactoryTest.php b/test/InputFilterPluginManagerFactoryTest.php
+index a1f5203..afbfbe9 100644
+--- a/test/InputFilterPluginManagerFactoryTest.php
++++ b/test/InputFilterPluginManagerFactoryTest.php
+@@ -18,7 +18,7 @@ class InputFilterPluginManagerFactoryTest extends TestCase
+
+ public function testFactoryReturnsPluginManager(): void
+ {
+- $container = $this->prophesize(ContainerInterface::class)->reveal();
++ $container = $this->createMock(ContainerInterface::class);
+ $factory = new InputFilterPluginManagerFactory();
+
+ $filters = $factory($container, InputFilterPluginManagerFactory::class);
+@@ -46,8 +46,8 @@ public function pluginProvider(): array
+ */
+ public function testFactoryConfiguresPluginManagerUnderContainerInterop(string $pluginType): void
+ {
+- $container = $this->prophesize(ContainerInterface::class)->reveal();
+- $plugin = $this->prophesize($pluginType)->reveal();
++ $container = $this->createMock(ContainerInterface::class);
++ $plugin = $this->createMock($pluginType);
+
+ $factory = new InputFilterPluginManagerFactory();
+ $filters = $factory($container, InputFilterPluginManagerFactory::class, [
+@@ -60,7 +60,7 @@ public function testFactoryConfiguresPluginManagerUnderContainerInterop(string $
+
+ public function testConfiguresInputFilterServicesWhenFound(): void
+ {
+- $inputFilter = $this->prophesize(InputFilterInterface::class)->reveal();
++ $inputFilter = $this->createMock(InputFilterInterface::class);
+ $config = [
+ 'input_filters' => [
+ 'aliases' => [
diff --git a/php-laminas-inputfilter.spec b/php-laminas-inputfilter.spec
index 0c2ba88..5e6399f 100644
--- a/php-laminas-inputfilter.spec
+++ b/php-laminas-inputfilter.spec
@@ -23,7 +23,7 @@
Name: php-%{gh_project}
Version: 2.18.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: %{namespace} Framework %{library} component
License: BSD
@@ -31,6 +31,8 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
Source1: makesrc.sh
+Patch0: %{name}-upstream.patch
+
BuildArch: noarch
# Tests
%if %{with_tests}
@@ -123,6 +125,7 @@ Documentation: https://docs.laminas.dev/%{gh_project}/
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1
mv LICENSE.md LICENSE
@@ -206,6 +209,9 @@ exit $ret
%{php_home}/%{namespace}/%{library}
%changelog
+* Wed Jul 20 2022 Remi Collet <remi@remirepo.net> - 2.18.0-2
+- fix FTBFS, using upstream patch for test suite
+
* Thu Jun 16 2022 Remi Collet <remi@remirepo.net> - 2.18.0-1
- update to 2.18.0