Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rizkytegar/laravel-phpunittest-example

This project is a Laravel application used to perform API testing against the reqres.in endpoints.
https://github.com/rizkytegar/laravel-phpunittest-example

laravel phpunit reqres-api unit-testing

Last synced: about 1 month ago
JSON representation

This project is a Laravel application used to perform API testing against the reqres.in endpoints.

Awesome Lists containing this project

README

        

# Laravel API Testing with Reqres.in

## Description

This project is a Laravel application used to perform API testing against the `reqres.in` endpoints. `reqres.in` is a dummy API service providing sample data for testing and development purposes. This project utilizes unit tests to validate various types of API requests, including GET, POST, PUT, and DELETE.

## Features

- **GET Request:** Fetch a list of users and a single user.
- **POST Request:** Create a new user.
- **PUT Request:** Update an existing user's information.
- **DELETE Request:** Delete a user by ID.

## Code Structure

- **tests/Feature/ApiTest.php:** Contains unit tests for testing `reqres.in` endpoints. The test cases include:
- `test_get_users_request()`: Tests the endpoint for fetching a list of users.
- `test_get_single_user_request()`: Tests the endpoint for fetching a single user.
- `test_post_request()`: Tests the endpoint for creating a new user.
- `test_put_request()`: Tests the endpoint for updating an existing user.
- `test_delete_request()`: Tests the endpoint for deleting a user.