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
