updates for active directory now with docs

This commit is contained in:
Mark Gregory
2026-11-12 08:28:46 +00:00
parent 7166dd33f9
commit 1c57e92780
6 changed files with 225 additions and 9 deletions
+26
View File
@@ -268,3 +268,29 @@ it('registers an overlap-protected ten-minute job only when scheduling is enable
->and($events->sole()->command)->toBe(Artisan::formatCommandString('ad:sync'));
}
})->with(['enabled' => [true], 'disabled' => [false]]);
it('prints directory details only with the debug option', function () {
$entry = directoryEntry() + ['account_control' => 512, 'account_flags' => ['NORMAL_ACCOUNT']];
directorySnapshot([$entry]);
$this->artisan('ad:sync --email --dry-run')
->doesntExpectOutputToContain('AD account')
->assertSuccessful();
directorySnapshot([$entry]);
$this->artisan('ad:sync --email --dry-run --debug')
->expectsOutput('AD account '.json_encode($entry, JSON_THROW_ON_ERROR))
->expectsOutputToContain('created=0')
->assertSuccessful();
expect(User::count())->toBe(0);
});
it('prints LDAP properties separately from normalized account details', function (string $flag) {
$properties = ['samaccountname' => ['ada'], 'userprincipalname' => ['[email protected]']];
$this->mock(ActiveDirectory::class)->shouldReceive('users')->with(true)->once()
->andReturn([directoryEntry() + ['ad_properties' => $properties]]);
$this->artisan('ad:sync --email --dry-run '.$flag)
->expectsOutput('AD properties '.json_encode($properties, JSON_THROW_ON_ERROR))
->doesntExpectOutputToContain('AD account')
->assertSuccessful();
})->with(['-dd', '--dump-ad']);