Skip to content

Commit

Permalink
Tests for isAccountEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Sep 17, 2024
1 parent 4ea8b11 commit 2211c6b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/Ltb/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,46 @@ public function test_activedirectory_reset_false_empty(): void
$this->assertFalse($reset, "Reset should be false");
}

public function test_activedirectory_isenabled_true(): void
{
$phpLDAPMock = Mockery::mock('overload:Ltb\PhpLDAP');
$phpLDAPMock->shouldreceive([
'ldap_read' => null,
'ldap_errno' => 0,
'ldap_get_entries' => [
'count' => 1,
0 => [
'useraccountcontrol' => [
'count' => 1,
0 => 512,
]
]
]
]);

$accountEnabled = (new Ltb\Directory\ActiveDirectory)->isAccountEnabled(null, null);
$this->assertTrue($accountEnabled, "Account should be enabled");
}

public function test_activedirectory_isenabled_false(): void
{
$phpLDAPMock = Mockery::mock('overload:Ltb\PhpLDAP');
$phpLDAPMock->shouldreceive([
'ldap_read' => null,
'ldap_errno' => 0,
'ldap_get_entries' => [
'count' => 1,
0 => [
'useraccountcontrol' => [
'count' => 1,
0 => 514,
]
]
]
]);

$accountEnabled = (new Ltb\Directory\ActiveDirectory)->isAccountEnabled(null, null);
$this->assertFalse($accountEnabled, "Account should be disabled");
}

}

0 comments on commit 2211c6b

Please sign in to comment.