Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acseo/ai-phpunit
AI PHPUnit is a tool that uses GPT-4 to automatically add missing PHPUnit tests to your PHP code
https://github.com/acseo/ai-phpunit
Last synced: about 2 months ago
JSON representation
AI PHPUnit is a tool that uses GPT-4 to automatically add missing PHPUnit tests to your PHP code
- Host: GitHub
- URL: https://github.com/acseo/ai-phpunit
- Owner: acseo
- License: agpl-3.0
- Created: 2024-08-17T11:13:56.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-17T12:09:11.000Z (4 months ago)
- Last Synced: 2024-10-20T18:11:03.671Z (2 months ago)
- Language: PHP
- Size: 30.3 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# AI PHPUnit
AI PHPUnit is a tool that uses GPT-4 to automatically add missing PHPUnit tests to your PHP code.
## Prerequisites
This package uses the OpenAI API. Before using AI PHPUnit, you will need to have an OpenAI API key set as an environment variable.
```shell
export OPENAI_KEY=...
```## Installation
To install AI PHPUnit, run the following command:
```shell
composer global require acseo/ai-phpunit
```## Usage
To add missing PHPUnit comments to a single file, use the following command:
```shell
aiphpunit file /path/to/file.php
```To add missing PHPUnit tests to a directory of files, use the following command. By default it iterates through the current directory for all files, but does not go into subdirectories:
```shell
aiphpunit dir
```You may set the `--recursive` flag, or `-r` for short for it to go into subdirectories.
If you pass another variable (regardless of the recursive flag) it will treat it as another directory to sweep through instead of the working directory.
```shell
aiphpunit dir -r /somewhere/else
```### Docker usage
You can use the Docker image acseo/ai-phpunit to use ai-phpunit via docker
```bash
$ docker run -it -e OPENAI_KEY=sk-xxx -v /path/to/your/code:/code acseo/ai-phpunit dir -r /code/src
```
## LicenseAI PHPUnit is licensed under the AGPL-3.0 license. See LICENSE for more information.
It is inspired by [ai-phpdoc](https://github.com/molbal/ai-phpdoc)