Ejemplo n.º 1
0
 public function testGetUserSubAdminGroupsWithoutGroups()
 {
     $targetUser = $this->getMock('\\OCP\\IUser');
     $this->userManager->expects($this->once())->method('get')->with('RequestedUser')->will($this->returnValue($targetUser));
     $subAdminManager = $this->getMockBuilder('\\OC\\Subadmin')->disableOriginalConstructor()->getMock();
     $subAdminManager->expects($this->once())->method('getSubAdminsGroups')->with($targetUser)->will($this->returnValue([]));
     $this->groupManager->expects($this->once())->method('getSubAdmin')->will($this->returnValue($subAdminManager));
     $expected = new \OC_OCS_Result(null, 102, 'Unknown error occurred');
     $this->assertEquals($expected, $this->api->getUserSubAdminGroups(['userid' => 'RequestedUser']));
 }
Ejemplo n.º 2
0
 public function testGetGroupsAsAdmin()
 {
     $this->groupManager->expects($this->once())->method('search')->with('Foo')->will($this->returnValue(['DummyValue']));
     $expected = ['DummyValue'];
     $this->assertSame($expected, $this->invokePrivate($this->groupMetadata, 'getGroups', ['Foo']));
 }