]> source.dussan.org Git - nextcloud-server.git/commitdiff
adapt tests for nc18 22204/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 12 Aug 2020 08:23:13 +0000 (10:23 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 12 Aug 2020 13:52:17 +0000 (15:52 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/user_ldap/tests/Group_LDAPTest.php

index f71b2472886a0be068612ec6960a350a846dc508..baf51cfe864becf9e0bc5573cce541e119bb8343 100644 (file)
@@ -80,7 +80,7 @@ class Group_LDAPTest extends TestCase {
        private function getPluginManagerMock() {
                return $this->getMockBuilder('\OCA\User_LDAP\GroupPluginManager')->getMock();
        }
-       
+
        /**
         * @param Access|\PHPUnit_Framework_MockObject_MockObject $access
         */
@@ -121,7 +121,12 @@ class Group_LDAPTest extends TestCase {
                                }
                                return [];
                        });
-
+               $access->expects($this->any())
+                       ->method('combineFilterWithAnd')
+                       ->willReturn('pseudo=filter');
+               $access->expects($this->any())
+                       ->method('fetchListOfUsers')
+                       ->will($this->returnValue([])); // return val does not matter here
                // for primary groups
                $access->expects($this->once())
                        ->method('countUsers')
@@ -170,6 +175,9 @@ class Group_LDAPTest extends TestCase {
                        ->will($this->returnCallback(function() {
                                return 'foobar' . \OC::$server->getSecureRandom()->generate(7);
                        }));
+               $access->expects($this->any())
+                       ->method('combineFilterWithAnd')
+                       ->willReturn('pseudo=filter');
 
                $access->userManager->expects($this->any())
                        ->method('getAttributes')
@@ -203,7 +211,7 @@ class Group_LDAPTest extends TestCase {
                $ldap = new GroupLDAP($access, $pluginManager);
 
                $this->assertEquals($ldap->countUsersInGroup('gid', 'search'),42);
-       }       
+       }
 
        public function testGidNumber2NameSuccess() {
                $access = $this->getAccessMock();
@@ -543,6 +551,9 @@ class Group_LDAPTest extends TestCase {
                $access->expects($this->exactly(2))
                        ->method('nextcloudUserNames')
                        ->willReturnOnConsecutiveCalls(['lisa', 'bart', 'kira', 'brad'], ['walle', 'dino', 'xenia']);
+               $access->expects($this->any())
+                       ->method('fetchListOfUsers')
+                       ->will($this->returnValue([])); // return val does not matter here
 
                $access->userManager->expects($this->any())
                        ->method('getAttributes')
@@ -581,7 +592,9 @@ class Group_LDAPTest extends TestCase {
                $access->expects($this->once())
                        ->method('nextcloudUserNames')
                        ->will($this->returnValue(array('lisa', 'bart', 'kira', 'brad')));
-
+               $access->expects($this->any())
+                       ->method('fetchListOfUsers')
+                       ->will($this->returnValue([])); // return val does not matter here
                $access->userManager->expects($this->any())
                        ->method('getAttributes')
                        ->willReturn(['displayName', 'mail']);
@@ -618,10 +631,15 @@ class Group_LDAPTest extends TestCase {
                $access->expects($this->any())
                        ->method('groupname2dn')
                        ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
-
+               $access->expects($this->any())
+                       ->method('fetchListOfUsers')
+                       ->will($this->returnValue([])); // return val does not matter here
                $access->expects($this->once())
                        ->method('countUsers')
                        ->will($this->returnValue(4));
+               $access->expects($this->any())
+                       ->method('combineFilterWithAnd')
+                       ->willReturn('pseudo=filter');
 
                $access->userManager->expects($this->any())
                        ->method('getAttributes')
@@ -790,7 +808,7 @@ class Group_LDAPTest extends TestCase {
                $this->assertEquals($ldap->createGroup('gid'),true);
        }
 
-       
+
        public function testCreateGroupFailing() {
                $this->expectException(\Exception::class);
 
@@ -845,7 +863,7 @@ class Group_LDAPTest extends TestCase {
                $this->assertEquals($ldap->deleteGroup('gid'),'result');
        }
 
-       
+
        public function testDeleteGroupFailing() {
                $this->expectException(\Exception::class);
 
@@ -891,7 +909,7 @@ class Group_LDAPTest extends TestCase {
                $this->assertEquals($ldap->addToGroup('uid', 'gid'),'result');
        }
 
-       
+
        public function testAddToGroupFailing() {
                $this->expectException(\Exception::class);
 
@@ -937,7 +955,7 @@ class Group_LDAPTest extends TestCase {
                $this->assertEquals($ldap->removeFromGroup('uid', 'gid'),'result');
        }
 
-       
+
        public function testRemoveFromGroupFailing() {
                $this->expectException(\Exception::class);
 
@@ -983,7 +1001,7 @@ class Group_LDAPTest extends TestCase {
                $this->assertEquals($ldap->getGroupDetails('gid'),'result');
        }
 
-       
+
        public function testGetGroupDetailsFailing() {
                $this->expectException(\Exception::class);