Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quill Testing Utilities

Fluent testing utilities for the Quill PHP Framework, making it easy to test your handlers and middleware without full HTTP round-trips.

This package provides a TestClient that wraps the internal App::handle() lifecycle, allowing you to simulate requests and assert on the results with a clean, expressive API.

Installation

composer require quillphp/testing

Usage

Getting Started

To test your application, create a TestClient instance passing your App kernel:

use Quill\Testing\TestClient;

class UserTest extends \PHPUnit\Framework\TestCase {
    public function test_it_returns_user_data() {
        $app = new \Quill\App();
        // ... set up routes ...
        
        $client = new TestClient($app);
        
        $client->get('/users/1')
            ->assertStatus(200)
            ->assertJson(['id' => 1, 'name' => 'John']);
    }
}

TestClient Methods

The TestClient supports all standard HTTP methods:

  • $client->get(string $uri, array $headers = [])
  • $client->post(string $uri, array $data = [], array $headers = [])
  • $client->put(string $uri, array $data = [], array $headers = [])
  • $client->patch(string $uri, array $data = [], array $headers = [])
  • $client->delete(string $uri, array $data = [], array $headers = [])

TestResponse Assertions

The response returned by the client allows for fluent assertions:

Method Description
assertStatus(int $code) Asserts the HTTP status code.
assertJson(array $subset) Asserts that the response body contains the given JSON subset.
assertHeader(string $name, string $value) Asserts a specific header value.
assertSee(string $string) Asserts that the response body contains the given string.

License

This package is open-sourced software licensed under the MIT license.

About

Fluent testing utilities for the Quill PHP Framework

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages