File: fixed-obsolete-getMock-usage.patch

package info (click to toggle)
php-symfony-security-acl 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 908 kB
  • sloc: php: 5,118; sql: 268; makefile: 16
file content (247 lines) | stat: -rw-r--r-- 13,400 bytes parent folder | download
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
From: Fabien Potencier <fabien.potencier@gmail.com>
Date: Mon, 19 Dec 2016 10:02:29 +0100
Subject: fixed obsolete getMock() usage

Origin: https://github.com/symfony/security-acl/commit/3a510c7919d2d5bd12caeec9bdfb1cd6c0343d25
Bug-Debian: https://bugs.debian.org/882924
---
 Tests/Dbal/MutableAclProviderTest.php                |  2 +-
 Tests/Domain/AclTest.php                             |  6 +++---
 Tests/Domain/AuditLoggerTest.php                     |  2 +-
 Tests/Domain/EntryTest.php                           |  4 ++--
 Tests/Domain/FieldEntryTest.php                      |  4 ++--
 Tests/Domain/PermissionGrantingStrategyTest.php      |  4 ++--
 .../Domain/SecurityIdentityRetrievalStrategyTest.php |  6 +++---
 Tests/Domain/UserSecurityIdentityTest.php            |  2 +-
 Tests/Voter/AclVoterTest.php                         | 20 ++++++++++----------
 9 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/Tests/Dbal/MutableAclProviderTest.php b/Tests/Dbal/MutableAclProviderTest.php
index c2169e4..6df2d79 100644
--- a/Tests/Dbal/MutableAclProviderTest.php
+++ b/Tests/Dbal/MutableAclProviderTest.php
@@ -255,7 +255,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
 
     public function testUpdateDoesNothingWhenThereAreNoChanges()
     {
-        $con = $this->getMock('Doctrine\DBAL\Connection', array(), array(), '', false);
+        $con = $this->getMockBuilder('Doctrine\DBAL\Connection')->disableOriginalConstructor()->getMock();
         $con
             ->expects($this->never())
             ->method('beginTransaction')
diff --git a/Tests/Domain/AclTest.php b/Tests/Domain/AclTest.php
index 84b9ba9..bfe85e2 100644
--- a/Tests/Domain/AclTest.php
+++ b/Tests/Domain/AclTest.php
@@ -208,7 +208,7 @@ class AclTest extends \PHPUnit_Framework_TestCase
     {
         $sids = array(new RoleSecurityIdentity('ROLE_FOO'), new RoleSecurityIdentity('ROLE_IDDQD'));
         $masks = array(1, 2, 4);
-        $strategy = $this->getMock('Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface');
+        $strategy = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface')->getMock();
         $acl = new Acl(1, new ObjectIdentity(1, 'foo'), $strategy, array(), true);
 
         $strategy
@@ -225,7 +225,7 @@ class AclTest extends \PHPUnit_Framework_TestCase
     {
         $sids = array(new RoleSecurityIdentity('ROLE_FOO'), new RoleSecurityIdentity('ROLE_IDDQD'));
         $masks = array(1, 2, 4);
-        $strategy = $this->getMock('Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface');
+        $strategy = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface')->getMock();
         $acl = new Acl(1, new ObjectIdentity(1, 'foo'), $strategy, array(), true);
 
         $strategy
@@ -488,7 +488,7 @@ class AclTest extends \PHPUnit_Framework_TestCase
     {
         $aceProperties = array('aceOrder', 'mask', 'strategy', 'auditSuccess', 'auditFailure');
 
-        $listener = $this->getMock('Doctrine\Common\PropertyChangedListener');
+        $listener = $this->getMockBuilder('Doctrine\Common\PropertyChangedListener')->getMock();
         foreach ($expectedChanges as $index => $property) {
             if (in_array($property, $aceProperties)) {
                 $class = 'Symfony\Component\Security\Acl\Domain\Entry';
diff --git a/Tests/Domain/AuditLoggerTest.php b/Tests/Domain/AuditLoggerTest.php
index 15538d3..ae11474 100644
--- a/Tests/Domain/AuditLoggerTest.php
+++ b/Tests/Domain/AuditLoggerTest.php
@@ -73,7 +73,7 @@ class AuditLoggerTest extends \PHPUnit_Framework_TestCase
 
     protected function getEntry()
     {
-        return $this->getMock('Symfony\Component\Security\Acl\Model\AuditableEntryInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AuditableEntryInterface')->getMock();
     }
 
     protected function getLogger()
diff --git a/Tests/Domain/EntryTest.php b/Tests/Domain/EntryTest.php
index ab8e481..58f2786 100644
--- a/Tests/Domain/EntryTest.php
+++ b/Tests/Domain/EntryTest.php
@@ -109,11 +109,11 @@ class EntryTest extends \PHPUnit_Framework_TestCase
 
     protected function getAcl()
     {
-        return $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock();
     }
 
     protected function getSid()
     {
-        return $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface')->getMock();
     }
 }
diff --git a/Tests/Domain/FieldEntryTest.php b/Tests/Domain/FieldEntryTest.php
index 735e2e8..55b083c 100644
--- a/Tests/Domain/FieldEntryTest.php
+++ b/Tests/Domain/FieldEntryTest.php
@@ -64,11 +64,11 @@ class FieldEntryTest extends \PHPUnit_Framework_TestCase
 
     protected function getAcl()
     {
-        return $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock();
     }
 
     protected function getSid()
     {
-        return $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Acl\Model\SecurityIdentityInterface')->getMock();
     }
 }
diff --git a/Tests/Domain/PermissionGrantingStrategyTest.php b/Tests/Domain/PermissionGrantingStrategyTest.php
index 34ef690..463f2c1 100644
--- a/Tests/Domain/PermissionGrantingStrategyTest.php
+++ b/Tests/Domain/PermissionGrantingStrategyTest.php
@@ -107,7 +107,7 @@ class PermissionGrantingStrategyTest extends \PHPUnit_Framework_TestCase
         $acl = $this->getAcl($strategy);
         $sid = new UserSecurityIdentity('johannes', 'Foo');
 
-        $logger = $this->getMock('Symfony\Component\Security\Acl\Model\AuditLoggerInterface');
+        $logger = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AuditLoggerInterface')->getMock();
         $logger
             ->expects($this->once())
             ->method('logIfNeeded')
@@ -126,7 +126,7 @@ class PermissionGrantingStrategyTest extends \PHPUnit_Framework_TestCase
         $acl = $this->getAcl($strategy);
         $sid = new UserSecurityIdentity('johannes', 'Foo');
 
-        $logger = $this->getMock('Symfony\Component\Security\Acl\Model\AuditLoggerInterface');
+        $logger = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AuditLoggerInterface')->getMock();
         $logger
             ->expects($this->once())
             ->method('logIfNeeded')
diff --git a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
index a734f31..f3d4491 100644
--- a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
+++ b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
@@ -109,7 +109,7 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase
 
     protected function getAccount($username, $class)
     {
-        $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface', array(), array(), $class);
+        $account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->setMockClassName($class)->getMock();
         $account
             ->expects($this->any())
             ->method('getUsername')
@@ -121,7 +121,7 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase
 
     protected function getStrategy(array $roles = array(), $authenticationStatus = 'fullFledged')
     {
-        $roleHierarchy = $this->getMock('Symfony\Component\Security\Core\Role\RoleHierarchyInterface');
+        $roleHierarchy = $this->getMockBuilder('Symfony\Component\Security\Core\Role\RoleHierarchyInterface')->getMock();
         $roleHierarchy
             ->expects($this->once())
             ->method('getReachableRoles')
@@ -129,7 +129,7 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($roles))
         ;
 
-        $trustResolver = $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface', array(), array('', ''));
+        $trustResolver = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface')->setConstructorArgs(array('', ''))->getMock();
 
         $trustResolver
             ->expects($this->at(0))
diff --git a/Tests/Domain/UserSecurityIdentityTest.php b/Tests/Domain/UserSecurityIdentityTest.php
index 09d3f0d..1eb5283 100644
--- a/Tests/Domain/UserSecurityIdentityTest.php
+++ b/Tests/Domain/UserSecurityIdentityTest.php
@@ -52,7 +52,7 @@ class UserSecurityIdentityTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue('foo'))
         ;
 
-        $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+        $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
         $token
             ->expects($this->any())
             ->method('getUser')
diff --git a/Tests/Voter/AclVoterTest.php b/Tests/Voter/AclVoterTest.php
index 2148135..bf8d674 100644
--- a/Tests/Voter/AclVoterTest.php
+++ b/Tests/Voter/AclVoterTest.php
@@ -213,7 +213,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('findAcl')
             ->with($this->equalTo($oid), $this->equalTo($sids))
-            ->will($this->returnValue($acl = $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface')))
+            ->will($this->returnValue($acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock()))
         ;
 
         $acl
@@ -259,7 +259,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('findAcl')
             ->with($this->equalTo($oid), $this->equalTo($sids))
-            ->will($this->returnValue($acl = $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface')))
+            ->will($this->returnValue($acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock()))
         ;
 
         $acl
@@ -302,7 +302,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('findAcl')
             ->with($this->equalTo($oid), $this->equalTo($sids))
-            ->will($this->returnValue($acl = $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface')))
+            ->will($this->returnValue($acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock()))
         ;
 
         $acl
@@ -348,7 +348,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('findAcl')
             ->with($this->equalTo($oid), $this->equalTo($sids))
-            ->will($this->returnValue($acl = $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface')))
+            ->will($this->returnValue($acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock()))
         ;
 
         $acl
@@ -389,7 +389,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('findAcl')
             ->with($this->equalTo($oid), $this->equalTo($sids))
-            ->will($this->returnValue($acl = $this->getMock('Symfony\Component\Security\Acl\Model\AclInterface')))
+            ->will($this->returnValue($acl = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclInterface')->getMock()))
         ;
 
         $acl
@@ -404,15 +404,15 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
 
     protected function getToken()
     {
-        return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+        return $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
     }
 
     protected function getVoter($allowIfObjectIdentityUnavailable = true, $alwaysContains = true)
     {
-        $provider = $this->getMock('Symfony\Component\Security\Acl\Model\AclProviderInterface');
-        $permissionMap = $this->getMock('Symfony\Component\Security\Acl\Permission\PermissionMapInterface');
-        $oidStrategy = $this->getMock('Symfony\Component\Security\Acl\Model\ObjectIdentityRetrievalStrategyInterface');
-        $sidStrategy = $this->getMock('Symfony\Component\Security\Acl\Model\SecurityIdentityRetrievalStrategyInterface');
+        $provider = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\AclProviderInterface')->getMock();
+        $permissionMap = $this->getMockBuilder('Symfony\Component\Security\Acl\Permission\PermissionMapInterface')->getMock();
+        $oidStrategy = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\ObjectIdentityRetrievalStrategyInterface')->getMock();
+        $sidStrategy = $this->getMockBuilder('Symfony\Component\Security\Acl\Model\SecurityIdentityRetrievalStrategyInterface')->getMock();
 
         if ($alwaysContains) {
             $permissionMap