Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorikfon committed Sep 18, 2024
1 parent 804d167 commit e991ebd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/Modules/ModuleLdapSync/Lib/LdapSyncMainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@
use Modules\ModuleLdapSync\Lib\LdapSyncConnector;
use Modules\ModuleLdapSync\Lib\LdapSyncMain;
use MikoPBX\Tests\Unit\AbstractUnitTest;
use Modules\ModuleLdapSync\Lib\LdapSyncUsers;
use Modules\ModuleLdapSync\Models\LdapServers;

class LdapSyncMainTest extends AbstractUnitTest
{

public function testSyncAllUsers()
{
$serversList = LdapServers::find('id=2')->toArray();
foreach ($serversList as $server) {
LdapSyncMain::syncUsersPerServer($server);
$serversList = LdapServers::find('id=1')->toArray();
foreach ($serversList as $ldapCredentials) {
LdapSyncMain::syncUsersPerServer($ldapCredentials);
}
$this->assertTrue(true);
}

public function testGetUsersList()
{
$serverParams = LdapServers::findFirstById(2)->toArray();
$serverParams = LdapServers::findFirstById(1)->toArray();

$attributes = json_decode($serverParams['attributes'], true);
$serverParams = array_merge($attributes, $serverParams);
Expand All @@ -50,4 +51,13 @@ public function testGetUsersList()
$this->assertTrue($res->success);
}

function testGetDisabledUsers()
{
$serversList = LdapServers::find('id=1')->toArray();
foreach ($serversList as $ldapCredentials) {
$res = LdapSyncUsers::getDisabledUsers($ldapCredentials['id']);
$this->assertTrue($res->success);
}
}

}

0 comments on commit e991ebd

Please sign in to comment.