]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adjust current tests to match the expectations
authorJuan Pablo Villafáñez <jvillafanez@solidgear.es>
Wed, 15 Mar 2017 07:55:14 +0000 (08:55 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 29 Mar 2017 11:32:16 +0000 (13:32 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/user_ldap/tests/User/UserTest.php

index c261a2abaa263e9f4df7974599bae3c5a34fb5c7..7a0e40b8563cb3e88f196e7f03c2ec5e31bd892d 100644 (file)
@@ -211,15 +211,17 @@ class UserTest extends \Test\TestCase {
 
                $connection->expects($this->at(0))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue('23 GB'));
+                       ->with($this->equalTo('ldapQuotaAttribute'))
+                       ->will($this->returnValue('myquota'));
 
+               /* Having a quota defined, the ldapQuotaDefault won't be used
                $connection->expects($this->at(1))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaAttribute'))
-                       ->will($this->returnValue('myquota'));
+                       ->with($this->equalTo('ldapQuotaDefault'))
+                       ->will($this->returnValue('23 GB'));
+               */
 
-               $connection->expects($this->exactly(2))
+               $connection->expects($this->exactly(1))
                        ->method('__get');
 
                $access->expects($this->once())
@@ -256,13 +258,13 @@ class UserTest extends \Test\TestCase {
 
                $connection->expects($this->at(0))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue('25 GB'));
+                       ->with($this->equalTo('ldapQuotaAttribute'))
+                       ->will($this->returnValue('myquota'));
 
                $connection->expects($this->at(1))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaAttribute'))
-                       ->will($this->returnValue('myquota'));
+                       ->with($this->equalTo('ldapQuotaDefault'))
+                       ->will($this->returnValue('25 GB'));
 
                $connection->expects($this->exactly(2))
                        ->method('__get');
@@ -301,15 +303,17 @@ class UserTest extends \Test\TestCase {
 
                $connection->expects($this->at(0))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue(''));
+                       ->with($this->equalTo('ldapQuotaAttribute'))
+                       ->will($this->returnValue('myquota'));
 
+               /* Having a quota set this won't be used
                $connection->expects($this->at(1))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaAttribute'))
-                       ->will($this->returnValue('myquota'));
+                       ->with($this->equalTo('ldapQuotaDefault'))
+                       ->will($this->returnValue(''));
+               */
 
-               $connection->expects($this->exactly(2))
+               $connection->expects($this->exactly(1))
                        ->method('__get');
 
                $access->expects($this->once())
@@ -346,13 +350,13 @@ class UserTest extends \Test\TestCase {
 
                $connection->expects($this->at(0))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue(''));
+                       ->with($this->equalTo('ldapQuotaAttribute'))
+                       ->will($this->returnValue('myquota'));
 
                $connection->expects($this->at(1))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaAttribute'))
-                       ->will($this->returnValue('myquota'));
+                       ->with($this->equalTo('ldapQuotaDefault'))
+                       ->will($this->returnValue(''));
 
                $connection->expects($this->exactly(2))
                        ->method('__get');
@@ -384,12 +388,12 @@ class UserTest extends \Test\TestCase {
 
                $connection->expects($this->at(0))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
+                       ->with($this->equalTo('ldapQuotaAttribute'))
                        ->will($this->returnValue(''));
 
                $connection->expects($this->at(1))
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaAttribute'))
+                       ->with($this->equalTo('ldapQuotaDefault'))
                        ->will($this->returnValue(''));
 
                $connection->expects($this->exactly(2))
@@ -419,15 +423,9 @@ class UserTest extends \Test\TestCase {
 
                $readQuota = '19 GB';
 
-               $connection->expects($this->at(0))
+               $connection->expects($this->never())
                        ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue(''));
-
-               $connection->expects($this->once(1))
-                       ->method('__get')
-                       ->with($this->equalTo('ldapQuotaDefault'))
-                       ->will($this->returnValue(null));
+                       ->with($this->equalTo('ldapQuotaDefault'));
 
                $access->expects($this->never())
                        ->method('readAttribute');