From fbd4e9e6513426b0809fcc6fc1faec72e6b52d2d Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 17 Dec 2018 14:55:00 +0100 Subject: add tests for the DUI as they are interact with the DB they are more integraiton than unit tests Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/User/DeletedUsersIndex.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apps/user_ldap/lib') diff --git a/apps/user_ldap/lib/User/DeletedUsersIndex.php b/apps/user_ldap/lib/User/DeletedUsersIndex.php index 9ec95a01b58..3473398f415 100644 --- a/apps/user_ldap/lib/User/DeletedUsersIndex.php +++ b/apps/user_ldap/lib/User/DeletedUsersIndex.php @@ -70,7 +70,7 @@ class DeletedUsersIndex { $deletedUsers = $this->config->getUsersForUserValue( 'user_ldap', 'isDeleted', '1'); - $userObjects = array(); + $userObjects = []; foreach($deletedUsers as $user) { $userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping); } @@ -95,20 +95,20 @@ class DeletedUsersIndex { * @return bool */ public function hasUsers() { - if($this->deletedUsers === false) { + if(!is_array($this->deletedUsers)) { $this->fetchDeletedUsers(); } - if(is_array($this->deletedUsers) && count($this->deletedUsers) > 0) { - return true; - } - return false; + return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); } /** * marks a user as deleted + * * @param string $ocName + * @throws \OCP\PreConditionNotMetException */ public function markUser($ocName) { $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); + $this->deletedUsers = null; } } -- cgit v1.2.3