Repository navigation
8.1.0 - 2026-11-16
A fluent testing API for JSON-RPC methods, with the existing helpers retained for compatibility.
Added
Sajya\Server\Testing\MakesRpcRequestswithwithRpcEndpoint()andrpc().- Configure the endpoint once in your test setup, then use
rpc('tennis@ping')with Laravel's standard response assertions. - A clear setup error when calling
rpc()without an endpoint.
Deprecated
ProceduralRequestsremains available with its existing behavior. Its four public methods carry native#[Deprecated]attributes; the trait has a PHPDoc deprecation tag. Native warnings are emitted on PHP 8.4 and later.
Migration
Replace ProceduralRequests with MakesRpcRequests:
use PHPUnit\Framework\Attributes\Test;
use Sajya\Server\Testing\MakesRpcRequests;
use Tests\TestCase;
class PingPongTest extends TestCase
{
use MakesRpcRequests;
protected function setUp(): void
{
parent::setUp();
$this->withRpcEndpoint(route('rpc.endpoint'));
}
#[Test]
public function ping_returns_pong(): void
{
$this->rpc('tennis@ping')
->assertOk()
->assertHeader('content-type', 'application/json')
->assertJsonPath('result', 'pong')
->assertJsonMissingPath('error');
}
}Use withRpcEndpoint(route($name)) instead of setRpcRoute($name), and withRpcEndpoint($url) instead of setRpcUrl($url).
Replace callProcedure() or callHttpProcedure() with rpc().
rpc() returns a TestResponse without automatic assertions. When replacing callProcedure(), keep its previous status and content-type checks explicitly, as shown above.
Tests
All server test methods and the test documentation examples use PHPUnit's #[Test] attribute instead of a test method prefix.
Full changelog: 8.0.0...8.1.0