Search by

pushinbr / pam-http-testing

DavidWilliamBalbino

In-memory HTTP testing utilities for Pam applications.

Package info

github.com/push-in/pam-http-testing

pkg:composer/pushinbr/pam-http-testing

Statistics

Installs: 55

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-22 23:55 UTC

This package is auto-updated.

Last update: 2026-11-17 09:59:00 UTC


README

pam-http-testing: Exercise your PAM HTTP application without opening a socket.

Exercise your HTTP application without opening a socket.
In-memory requests and fluent response assertions for applications built with pushinbr/pam-http.

Packagist PHP 8.5 CI License

Install · Quick example · API · Docs · Issues

Install

Projects created with pam init my-api --template http already require it as a dev dependency. Elsewhere:

pam composer require --dev pushinbr/pam-http-testing
pam test

Quick example

<?php

declare(strict_types=1);

use Pam\App;
use Pam\Http\Request;
use Pam\Http\Response;
use Pam\Http\Testing\TestClient;
use PHPUnit\Framework\TestCase;

final class ApplicationTest extends TestCase
{
    public function test_ping_endpoint(): void
    {
        $app = new App(discoverPackages: false);
        $app->get('/api/ping', static fn (Request $request, Response $response): Response => $response->json(['message' => 'pong']));

        (new TestClient($app))
            ->get('/api/ping')
            ->assertSuccessful()
            ->assertJson(['message' => 'pong']);
    }
}

Run it with pam test. The old Pam\Testing\TestClient and Pam\Testing\TestResponse names remain available as aliases.

What you can build

  • Fast controller and middleware tests
  • JSON, headers, status, and validation assertions
  • Regression suites for routes without network flakiness
Role Testing toolkit
Execution path PHPUnit-compatible in-memory HTTP harness
This repository owns Application-level HTTP test ergonomics
Boundary Transport, TLS, proxy, and kernel behavior still require integration tests

API

Surface Methods
TestClient request(), get($target, $headers), postJson($target, $payload, $headers)
TestResponse assertStatus(), assertSuccessful(), assertHeader(), assertJson(), assertJsonPath(), header(), json()
$client = new Pam\Http\Testing\TestClient($app);
$client->get('/users/42')
    ->assertSuccessful()
    ->assertJsonPath('id', '42');

Docs

Part of the PAM ecosystem

PAM

PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.

PAM PAM Desktop PAM Native Ecosystem
the runtime and CLI native desktop apps in PHP native Android and iOS apps in PHP every official package and plugin

Docs: push-in.github.io/pam-docs · Issues

Apache License 2.0: use, modify and distribute for any purpose, including commercially · Made in Brazil by Pushin