A barebones implementation of an atproto PDS in PHP and Slim Framework 4.
pds php atproto
0

Configure Feed

Select the types of activity you want to include in your feed.

test: add tests to basic routes

Andrés Ignacio Torres (May 17, 2026, 9:40 AM -0700) 9658715f 32fa5d61

+61
+5
app/routes.php
··· 42 42 return $response; 43 43 }); 44 44 45 + $app->get('/robots.txt', function (Request $request, Response $response) { 46 + $response->getBody()->write("User-agent: *\nAllow: /"); 47 + return $response->withHeader('Content-Type', 'text/plain'); 48 + }); 49 + 45 50 $app->group('/xrpc', function (Group $group) { 46 51 // atproto server 47 52 $group->get('/com.atproto.server.describeServer', DescribeServerAction::class);
+56
tests/Application/Actions/RoutesTest.php
··· 1 + <?php 2 + 3 + declare(strict_types=1); 4 + 5 + namespace Tests\Application\Actions; 6 + 7 + use Tests\TestCase; 8 + 9 + class RoutesTest extends TestCase 10 + { 11 + public function testHealthEndpointReturnsOk(): void 12 + { 13 + $app = $this->getAppInstance(); 14 + $request = $this->createRequest('GET', '/health'); 15 + $response = $app->handle($request); 16 + 17 + $this->assertEquals(200, $response->getStatusCode()); 18 + $this->assertEquals('ok', (string) $response->getBody()); 19 + } 20 + 21 + public function testXrpcHealthEndpointReturnsVersion(): void 22 + { 23 + $app = $this->getAppInstance(); 24 + $request = $this->createRequest('GET', '/xrpc/_health'); 25 + $response = $app->handle($request); 26 + 27 + $this->assertEquals(200, $response->getStatusCode()); 28 + $this->assertStringContainsString('version', (string) $response->getBody()); 29 + } 30 + 31 + public function testRobotsTxtEndpointReturnsRobotsTxt(): void 32 + { 33 + $app = $this->getAppInstance(); 34 + $request = $this->createRequest('GET', '/robots.txt'); 35 + $response = $app->handle($request); 36 + 37 + $this->assertEquals(200, $response->getStatusCode()); 38 + $this->assertEquals('text/plain', $response->getHeaderLine('Content-Type')); 39 + $this->assertStringContainsString('User-agent: *', (string) $response->getBody()); 40 + $this->assertStringContainsString('Allow: /', (string) $response->getBody()); 41 + } 42 + 43 + public function testRootEndpointReturnsWelcomePage(): void 44 + { 45 + $app = $this->getAppInstance(); 46 + $request = $this->createRequest('GET', '/'); 47 + $response = $app->handle($request); 48 + 49 + $this->assertEquals(200, $response->getStatusCode()); 50 + 51 + $body = (string) $response->getBody(); 52 + $this->assertStringContainsString('phpds', $body); 53 + $this->assertStringContainsString('atproto personal data server', $body); 54 + $this->assertStringContainsString('/xrpc/', $body); 55 + } 56 + }