1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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' => [
|