File: 1010_phpunit-8.x%2B9.x.patch

package info (click to toggle)
php-horde-injector 2.0.5-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 348 kB
  • sloc: php: 964; xml: 339; sh: 3; makefile: 2
file content (155 lines) | stat: -rw-r--r-- 6,593 bytes parent folder | download | duplicates (2)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
Description: Adapt to PHPUnit 8.x and 9.x API.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

Index: php-horde-injector/Horde_Injector-2.0.5/test/Horde/Injector/Binder/ImplementationTest.php
===================================================================
--- php-horde-injector.orig/Horde_Injector-2.0.5/test/Horde/Injector/Binder/ImplementationTest.php
+++ php-horde-injector/Horde_Injector-2.0.5/test/Horde/Injector/Binder/ImplementationTest.php
@@ -1,7 +1,7 @@
 <?php
 class Horde_Injector_Binder_ImplementationTest extends Horde_Test_Case
 {
-    public function setUp()
+    public function setUp(): void
     {
         $this->df = new Horde_Injector_DependencyFinder();
     }
@@ -49,11 +49,9 @@ class Horde_Injector_Binder_Implementati
         );
     }
 
-    /**
-     * @expectedException Horde_Injector_Exception
-     */
     public function testShouldThrowExceptionWhenTryingToCreateInstanceOfClassWithUntypedDependencies()
     {
+        $this->expectException('Horde_Injector_Exception');
         $implBinder = new Horde_Injector_Binder_Implementation(
             'Horde_Injector_Binder_ImplementationTest__UntypedDependency',
             $this->df
@@ -74,11 +72,9 @@ class Horde_Injector_Binder_Implementati
         $this->assertEquals('DEPENDENCY', $createdInstance->dep);
     }
 
-    /**
-     * @expectedException Horde_Injector_Exception
-     */
     public function testShouldThrowExceptionIfRequestedClassIsNotDefined()
     {
+        $this->expectException('Horde_Injector_Exception');
         $implBinder = new Horde_Injector_Binder_Implementation(
             'CLASS_DOES_NOT_EXIST',
             $this->df
@@ -87,11 +83,9 @@ class Horde_Injector_Binder_Implementati
         $implBinder->create($this->_getInjectorNeverCallMock());
     }
 
-    /**
-     * @expectedException Horde_Injector_Exception
-     */
     public function testShouldThrowExceptionIfImplementationIsAnInterface()
     {
+        $this->expectException('Horde_Injector_Exception');
         $implBinder = new Horde_Injector_Binder_Implementation(
             'Horde_Injector_Binder_ImplementationTest__Interface',
             $this->df
@@ -100,11 +94,9 @@ class Horde_Injector_Binder_Implementati
         $implBinder->create($this->_getInjectorNeverCallMock());
     }
 
-    /**
-     * @expectedException Horde_Injector_Exception
-     */
     public function testShouldThrowExceptionIfImplementationIsAnAbstractClass()
     {
+        $this->expectException('Horde_Injector_Exception');
         $implBinder = new Horde_Injector_Binder_Implementation(
             'Horde_Injector_Binder_ImplementationTest__AbstractClass',
             $this->df
Index: php-horde-injector/Horde_Injector-2.0.5/test/Horde/Injector/InjectorTest.php
===================================================================
--- php-horde-injector.orig/Horde_Injector-2.0.5/test/Horde/Injector/InjectorTest.php
+++ php-horde-injector/Horde_Injector-2.0.5/test/Horde/Injector/InjectorTest.php
@@ -1,9 +1,11 @@
 <?php
-class Horde_Injector_InjectorTest extends PHPUnit_Framework_TestCase
+class Horde_Injector_InjectorTest extends Horde_Test_Case
 {
     public function testShouldGetDefaultImplementationBinder()
     {
-        $topLevel = $this->getMock('Horde_Injector_TopLevel', array('getBinder'));
+        $topLevel = $this->getMockBuilder('Horde_Injector_TopLevel')
+                         ->setMethods(array('getBinder'))
+                         ->getMock();
         $topLevel->expects($this->once())
             ->method('getBinder')
             ->with($this->equalTo('UNBOUND_INTERFACE'))
@@ -42,20 +44,16 @@ class Horde_Injector_InjectorTest extend
             $injector->getBinder('BOUND_INTERFACE'));
     }
 
-    /**
-     * @expectedException BadMethodCallException
-     */
     public function testShouldThrowExceptionIfInterfaceNameIsNotPassedToMagicFactoryMethodForBinderAddition()
     {
+        $this->expectException('BadMethodCallException');
         $injector = new Horde_Injector($this->_getTopLevelNeverCalledMock());
         $injector->bindMock();
     }
 
-    /**
-     * @expectedException BadMethodCallException
-     */
     public function testShouldThrowExceptionIfMethodNameIsInvalid()
     {
+        $this->expectException('BadMethodCallException');
         $injector = new Horde_Injector($this->_getTopLevelNeverCalledMock());
         $injector->invalid();
     }
@@ -159,7 +157,9 @@ class Horde_Injector_InjectorTest extend
      */
     public function testChildInjectorsDoNotAskParentForInstanceIfBindingIsSet()
     {
-        $mockTopLevel = $this->getMock('Horde_Injector_TopLevel', array('getInstance'));
+        $mockTopLevel = $this->getMockBuilder('Horde_Injector_TopLevel')
+                             ->setMethods(array('getInstance'))
+                             ->getMock();
         $mockTopLevel->expects($this->never())->method('getInstance');
         $injector = new Horde_Injector($mockTopLevel);
 
@@ -169,8 +169,9 @@ class Horde_Injector_InjectorTest extend
 
     public function testChildInjectorAsksParentForInstance()
     {
-        $topLevelMock = $this->getMock('Horde_Injector_TopLevel', array('getInstance'));
-
+        $topLevelMock = $this->getMockBuilder('Horde_Injector_TopLevel')
+                             ->setMethods(array('getInstance'))
+                             ->getMock();
         $topLevelMock->expects($this->once())
             ->method('getInstance')
             ->with('StdClass');
@@ -225,7 +226,10 @@ class Horde_Injector_InjectorTest extend
 
     public function testShouldAllowChildInjectorsAccessToParentInjectorBindings()
     {
-        $mockInjector = $this->getMock('Horde_Injector_TopLevel', array('getBinder'));
+        $mockInjector = $this->getMockBuilder('Horde_Injector_TopLevel')
+                             ->setMethods(array('getBinder'))
+                             ->getMock();
+
         $mockInjector->expects($this->any()) // this gets called once in addBinder
             ->method('getBinder')
             ->with('BOUND_INTERFACE')
@@ -240,7 +244,9 @@ class Horde_Injector_InjectorTest extend
 
     private function _getTopLevelNeverCalledMock()
     {
-        $topLevel = $this->getMock('Horde_Injector_TopLevel', array('getBinder', 'getInstance'));
+        $topLevel = $this->getMockBuilder('Horde_Injector_TopLevel')
+                         ->setMethods(array('getBinder', 'getInstance'))
+                         ->getMock();
         $topLevel->expects($this->never())->method('getBinder');
         return $topLevel;
     }