Files
ADconsle/tests/Unit/LdapAttributeHelperTest.php
T
kzbkowskiandClaude Sonnet 5 1126d96271
CI / PHP 8.2 (push) Failing after 2m46s
CI / PHP 8.3 (push) Failing after 59s
CI / PHP 8.4 (push) Failing after 1m7s
ADconsole v1.0.0
First public release.

- docs: document the audit log, user offboarding, CSV export and the
  "require a reason for destructive actions" setting across README, docs/
  and CLAUDE/AGENTS.md; note retention for panel_audit
- docs: fill the publishing placeholders (repo URL, security contact,
  issue-template links) and add a semantic-versioning policy
- move agent/contributor context into CLAUDE/ (AGENTS.md + a README);
  root CLAUDE.md is now a thin @-import pointer
- add a favicon (shield-lock, matching the login screen) to the login
  page and the app layout
- CHANGELOG: promote [Unreleased] to [1.0.0]; keep the earlier internal
  build as [0.1.0]

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UfuvfwexztdS7LDpGuKsuK
2026-09-08 23:14:39 +02:00

44 lines
1.5 KiB
PHP

<?php
namespace Tests\Unit;
use App\Services\LdapAttributeHelper;
use Carbon\Carbon;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class LdapAttributeHelperTest extends TestCase
{
#[Test]
public function it_passes_through_already_casted_date_objects(): void
{
// LdapRecord dla modeli AD sam rzutuje pola typu pwdLastSet na obiekty
// daty - helper nie może ich mangować do null.
$date = Carbon::parse('2026-09-03 11:26:45');
$result = LdapAttributeHelper::windowsTimestampToCarbon($date);
$this->assertInstanceOf(Carbon::class, $result);
$this->assertSame('2026-09-03 11:26:45', $result->format('Y-m-d H:i:s'));
}
#[Test]
public function it_converts_raw_windows_filetime_strings(): void
{
// 133697178050000000 = 2024-09-02 02:30:05 UTC
$result = LdapAttributeHelper::windowsTimestampToCarbon('133697178050000000');
$this->assertInstanceOf(Carbon::class, $result);
$this->assertSame('2024-09-02', $result->format('Y-m-d'));
}
#[Test]
public function it_returns_null_for_zero_and_never_values(): void
{
$this->assertNull(LdapAttributeHelper::windowsTimestampToCarbon('0'));
$this->assertNull(LdapAttributeHelper::windowsTimestampToCarbon('9223372036854775807'));
$this->assertNull(LdapAttributeHelper::windowsTimestampToCarbon(''));
$this->assertNull(LdapAttributeHelper::windowsTimestampToCarbon(null));
}
}