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.
1.6 kB · 58 lines
PHP
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859<?php
declare(strict_types=1);
namespace Tests\Application\Actions;
use App\Application\Actions\ActionError;use Tests\TestCase;
class ActionErrorTest extends TestCase{ public function testConstructorAndGetters(): void { $error = new ActionError(ActionError::BAD_REQUEST, 'Invalid input');
$this->assertSame(ActionError::BAD_REQUEST, $error->getType()); $this->assertSame('Invalid input', $error->getDescription()); }
public function testDescriptionDefaultsToNull(): void { $error = new ActionError(ActionError::SERVER_ERROR);
$this->assertNull($error->getDescription()); }
public function testSettersAreFluentAndUpdateValues(): void { $error = new ActionError(ActionError::SERVER_ERROR);
$result = $error ->setType(ActionError::VALIDATION_ERROR) ->setDescription('Bad field');
$this->assertSame($error, $result); $this->assertSame(ActionError::VALIDATION_ERROR, $error->getType()); $this->assertSame('Bad field', $error->getDescription()); }
public function testSetDescriptionAcceptsNull(): void { $error = new ActionError(ActionError::SERVER_ERROR, 'oops');
$error->setDescription();
$this->assertNull($error->getDescription()); }
public function testJsonSerialize(): void { $error = new ActionError(ActionError::NOT_ALLOWED, 'nope');
$this->assertSame( ['type' => ActionError::NOT_ALLOWED, 'description' => 'nope'], $error->jsonSerialize() ); }}