@@ -102,17 +102,11 @@ public function testSaveGlobalCredentialsAsAdminForAnotherUser() {
102102 ->expects ($ this ->once ())
103103 ->method ('getUser ' )
104104 ->willReturn ($ user );
105- $ this ->groupManager
106- ->expects ($ this ->once ())
107- ->method ('isAdmin ' )
108- ->with ('MyAdminUid ' )
109- ->willReturn (true );
110105 $ this ->globalAuth
111- ->expects ($ this ->once ())
112- ->method ('saveAuth ' )
113- ->with ('UidOfTestUser ' , 'test ' , 'password ' );
106+ ->expects ($ this ->never ())
107+ ->method ('saveAuth ' );
114108
115- $ this ->assertSame (true , $ this ->ajaxController ->saveGlobalCredentials ('UidOfTestUser ' , 'test ' , 'password ' ));
109+ $ this ->assertSame (false , $ this ->ajaxController ->saveGlobalCredentials ('UidOfTestUser ' , 'test ' , 'password ' ));
116110 }
117111
118112 public function testSaveGlobalCredentialsAsAdminForSelf () {
@@ -125,11 +119,6 @@ public function testSaveGlobalCredentialsAsAdminForSelf() {
125119 ->expects ($ this ->once ())
126120 ->method ('getUser ' )
127121 ->willReturn ($ user );
128- $ this ->groupManager
129- ->expects ($ this ->once ())
130- ->method ('isAdmin ' )
131- ->with ('MyAdminUid ' )
132- ->willReturn (true );
133122 $ this ->globalAuth
134123 ->expects ($ this ->once ())
135124 ->method ('saveAuth ' )
@@ -141,18 +130,13 @@ public function testSaveGlobalCredentialsAsAdminForSelf() {
141130 public function testSaveGlobalCredentialsAsNormalUserForSelf () {
142131 $ user = $ this ->createMock (IUser::class);
143132 $ user
144- ->expects ($ this ->exactly ( 2 ))
133+ ->expects ($ this ->once ( ))
145134 ->method ('getUID ' )
146135 ->willReturn ('MyUserUid ' );
147136 $ this ->userSession
148137 ->expects ($ this ->once ())
149138 ->method ('getUser ' )
150139 ->willReturn ($ user );
151- $ this ->groupManager
152- ->expects ($ this ->once ())
153- ->method ('isAdmin ' )
154- ->with ('MyUserUid ' )
155- ->willReturn (false );
156140 $ this ->globalAuth
157141 ->expects ($ this ->once ())
158142 ->method ('saveAuth ' )
@@ -164,18 +148,16 @@ public function testSaveGlobalCredentialsAsNormalUserForSelf() {
164148 public function testSaveGlobalCredentialsAsNormalUserForAnotherUser () {
165149 $ user = $ this ->createMock (IUser::class);
166150 $ user
167- ->expects ($ this ->exactly ( 2 ))
151+ ->expects ($ this ->once ( ))
168152 ->method ('getUID ' )
169153 ->willReturn ('MyUserUid ' );
170154 $ this ->userSession
171155 ->expects ($ this ->once ())
172156 ->method ('getUser ' )
173157 ->willReturn ($ user );
174- $ this ->groupManager
175- ->expects ($ this ->once ())
176- ->method ('isAdmin ' )
177- ->with ('MyUserUid ' )
178- ->willReturn (false );
158+ $ this ->globalAuth
159+ ->expects ($ this ->never ())
160+ ->method ('saveAuth ' );
179161
180162 $ this ->assertSame (false , $ this ->ajaxController ->saveGlobalCredentials ('AnotherUserUid ' , 'test ' , 'password ' ));
181163 }
0 commit comments