]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update tests for phunit 5.5
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>
Tue, 27 Sep 2016 20:54:37 +0000 (23:54 +0300)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 12 Oct 2016 23:06:45 +0000 (01:06 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/user_ldap/tests/AccessTest.php
apps/user_ldap/tests/ConnectionTest.php
apps/user_ldap/tests/Group_LDAPTest.php
apps/user_ldap/tests/User/UserTest.php
apps/user_ldap/tests/WizardTest.php

index eb660afee70eb2837855227ce9e6ed5dde97d2c7..f7b6fa3633489e7ebec03d1d898a81cf55d2432a 100644 (file)
@@ -55,11 +55,11 @@ class AccessTest extends \Test\TestCase {
                        $umMethods  = get_class_methods('\OCA\User_LDAP\User\Manager');
                }
                $lw  = $this->createMock(ILDAPWrapper::class);
-               $connector = $this->getMock('\OCA\User_LDAP\Connection',
-                                                                       $conMethods,
-                                                                       array($lw, null, null));
-               $um = $this->getMock('\OCA\User_LDAP\User\Manager',
-                       $umMethods, array(
+               $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+                       ->setMethods($conMethods)
+                       ->setConstructorArgs([$lw, null, null])
+                       ->getMock();
+               $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
                                $this->createMock(IConfig::class),
                                $this->createMock(FilesystemHelper::class),
                                $this->createMock(LogWrapper::class),
@@ -68,6 +68,9 @@ class AccessTest extends \Test\TestCase {
                                $this->createMock(IDBConnection::class),
                                $this->createMock(IUserManager::class)));
                $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
+                               $this->createMock('\OCP\IUserManager')
+                       ])
+                       ->getMock();
 
                return array($lw, $connector, $um, $helper);
        }
index fcff65efb33190911b1a31121a3a96a54922315c..e013773b7d94b53f7dc51fffbc8048dfa53231cf 100644 (file)
@@ -47,9 +47,9 @@ class ConnectionTest extends \Test\TestCase {
                $this->ldap       = $this->createMock(ILDAPWrapper::class);
                // we use a mock here to replace the cache mechanism, due to missing DI in LDAP backend.
                $this->connection = $this->getMockBuilder('OCA\User_LDAP\Connection')
-                                                                ->setMethods(['getFromCache', 'writeToCache'])
-                                                                ->setConstructorArgs([$this->ldap, '', null])
-                                                                ->getMock();
+                       ->setMethods(['getFromCache', 'writeToCache'])
+                       ->setConstructorArgs([$this->ldap, '', null])
+                       ->getMock();
 
                $this->ldap->expects($this->any())
                        ->method('areLDAPFunctionsAvailable')
index 9bda3b8ceb572af29fc0df8e39290026ad0448ed..906db6bb17b546cf9dc329e534c81e0c45e9c78d 100644 (file)
@@ -48,16 +48,18 @@ class Group_LDAPTest extends \Test\TestCase {
                        $accMethods = get_class_methods('\OCA\User_LDAP\Access');
                }
                $lw  = $this->createMock(ILDAPWrapper::class);
-               $connector = $this->getMock('\OCA\User_LDAP\Connection',
-                                                                       $conMethods,
-                                                                       array($lw, null, null));
+               $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+                       ->setMethods($conMethods)
+                       ->setConstructorArgs([$lw, null, null])
+                       ->getMock();
                $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
                        ->disableOriginalConstructor()
                        ->getMock();
                $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
-               $access = $this->getMock('\OCA\User_LDAP\Access',
-                                                                $accMethods,
-                                                                array($connector, $lw, $um, $helper));
+               $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+                       ->setMethods($accMethods)
+                       ->setConstructorArgs([$connector, $lw, $um, $helper])
+                       ->getMock();
 
                $access->expects($this->any())
                        ->method('getConnection')
index 121b1102653f2134947bfedd0183f555b8ee3c20..c261a2abaa263e9f4df7974599bae3c5a34fb5c7 100644 (file)
@@ -77,13 +77,19 @@ class UserTest extends \Test\TestCase {
                if (is_null($userMgr)) {
                        $userMgr = $this->createMock(IUserManager::class);
                }
-               $um = $this->getMock('\OCA\User_LDAP\User\Manager',
-                       $umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
-               $connector = $this->getMock('\OCA\User_LDAP\Connection',
-                       $conMethods, array($lw, null, null));
+               $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
+                       ->setMethods($umMethods)
+                       ->setConstructorArgs([$cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr])
+                       ->getMock();
                $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
-               $access = $this->getMock('\OCA\User_LDAP\Access',
-                       $accMethods, array($connector, $lw, $um, $helper));
+               $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+                       ->setMethods($conMethods)
+                       ->setConstructorArgs([$lw, null, null])
+                       ->getMock();
+               $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+                       ->setMethods($accMethods)
+                       ->setConstructorArgs([$connector, $lw, $um, $helper])
+                       ->getMock();
 
                return array($access, $connector);
        }
index af3b692c7dd6c8b14ef417602a06f82a6ab42e99..545d112338bedf26307b137052566582db9a24f7 100644 (file)
@@ -61,18 +61,24 @@ class WizardTest extends \Test\TestCase {
                        $accMethods  = get_class_methods('\OCA\User_LDAP\Access');
                }
                $lw   = $this->createMock(ILDAPWrapper::class);
-               $conf = $this->getMock('\OCA\User_LDAP\Configuration',
-                                                          $confMethods,
-                                                          array($lw, null, null));
-
-               $connector = $this->getMock('\OCA\User_LDAP\Connection',
-                       $connMethods, array($lw, null, null));
+               $conf = $this->getMockBuilder('\OCA\User_LDAP\Configuration')
+                       ->setMethods($confMethods)
+                       ->setConstructorArgs([$lw, null, null])
+                       ->getMock();
+
+               $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+                       ->setMethods($connMethods)
+                       ->setConstructorArgs([$lw, null, null])
+                       ->getMock();
+                       
                $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
-                                       ->disableOriginalConstructor()
-                                       ->getMock();
+                       ->disableOriginalConstructor()
+                       ->getMock();
                $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
-               $access = $this->getMock('\OCA\User_LDAP\Access',
-                       $accMethods, array($connector, $lw, $um, $helper));
+               $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+                       ->setMethods($accMethods)
+                       ->setConstructorArgs([$connector, $lw, $um, $helper])
+                       ->getMock();
 
                return array(new Wizard($conf, $lw, $access), $conf, $lw, $access);
        }