Something went wrong. Try again.
A barebones implementation of an atproto PDS in PHP and Slim Framework 4.
pds php atproto
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576<?php
declare(strict_types=1);
namespace Tests\Domain\Account;
use App\Domain\Account\Account;use DateTimeImmutable;use Tests\TestCase;
class AccountTest extends TestCase{ public function testGettersWithAllFields(): void { $emailConfirmedAt = new DateTimeImmutable('2026-01-01T00:00:00Z');
$account = new Account( did: 'did:web:alice.pds.test', email: 'alice@pds.test', passwordScrypt: 'hash', emailConfirmedAt: $emailConfirmedAt, invitesDisabled: true, );
$this->assertSame('did:web:alice.pds.test', $account->getDid()); $this->assertSame('alice@pds.test', $account->getEmail()); $this->assertSame('hash', $account->getPasswordScrypt()); $this->assertEquals($emailConfirmedAt, $account->getEmailConfirmedAt()); $this->assertTrue($account->isInvitesDisabled()); }
public function testDefaultsForOptionalFields(): void { $account = new Account( did: 'did:web:alice.pds.test', email: 'alice@pds.test', passwordScrypt: 'hash', );
$this->assertNull($account->getEmailConfirmedAt()); $this->assertFalse($account->isInvitesDisabled()); }
public function testConstructorNormalizesEmail(): void { $account = new Account( did: 'did:web:alice.pds.test', email: ' Alice@PDS.test ', passwordScrypt: 'hash', );
$this->assertSame('alice@pds.test', $account->getEmail()); }
public function testJsonSerializeFormatsDatetimeAndOmitsPasswordScrypt(): void { $account = new Account( did: 'did:web:alice.pds.test', email: 'alice@pds.test', passwordScrypt: 'secret', emailConfirmedAt: new DateTimeImmutable('2026-01-01T00:00:00Z'), invitesDisabled: false, );
$json = json_decode((string) json_encode($account), true);
$this->assertSame([ 'did' => 'did:web:alice.pds.test', 'email' => 'alice@pds.test', 'emailConfirmedAt' => '2026-01-01T00:00:00+00:00', 'invitesDisabled' => false, ], $json); $this->assertArrayNotHasKey('passwordScrypt', $json); }}