Skip to content

Commit 8faf674

Browse files
committed
docs: add CONTRIBUTING.md, issue templates and PR template
1 parent 1e61eb5 commit 8faf674

6 files changed

Lines changed: 362 additions & 27 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: Create a report to help us improve
4+
title: 'bug: '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Configure module in `acceptance.suite.yml` with ...
16+
2. Run test with `$I->...`
17+
3. See error ...
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots/Logs**
23+
If applicable, add screenshots or terminal output to help explain your problem.
24+
25+
**Environment (please complete the following information):**
26+
- OS: [e.g. Ubuntu 22.04]
27+
- PHP Version: [e.g. 8.3.1]
28+
- Codeception Version: [e.g. 5.1.0]
29+
- Mock Server Version: [e.g. 1.2.0]
30+
31+
**Additional context**
32+
Add any other context about the problem here (e.g., specific OpenAPI spec features used).
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: ✨ Feature Request
3+
about: Suggest an idea for this project
4+
title: 'feat: '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Summary
2+
A clear and concise description of the changes in this PR.
3+
4+
## Related Issue(s)
5+
Fixes #[issue-number]
6+
Related to #[issue-number]
7+
8+
## Type of Change
9+
Please delete options that are not relevant.
10+
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
11+
- [ ] ✨ New feature (non-breaking change which adds functionality)
12+
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
13+
- [ ] 📚 Documentation update
14+
- [ ] 🛠️ Refactor / internal improvement
15+
16+
## Checklist:
17+
- [ ] My code follows the code style of this project (`composer cs:check` passes).
18+
- [ ] I have performed a self-review of my own code.
19+
- [ ] I have commented my code, particularly in hard-to-understand areas.
20+
- [ ] I have made corresponding changes to the documentation.
21+
- [ ] My changes generate no new warnings in PHPStan (`composer stan` passes).
22+
- [ ] I have added tests that prove my fix is effective or that my feature works (`composer test` passes).
23+
- [ ] New and existing unit tests pass locally with my changes.

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contributing to Codeception Module for PHP OpenAPI Mock Server
2+
3+
First off, thank you for considering contributing to this project! It's people like you who make the open-source community such an amazing place to learn, inspire, and create.
4+
5+
## 🛠️ Development Setup
6+
7+
To get started with development, you'll need to have PHP 8.3+ and Composer installed on your machine.
8+
9+
1. **Fork the repository** on GitHub.
10+
2. **Clone your fork** locally:
11+
```bash
12+
git clone https://github.com/your-username/codeception-module-openapi-server-mock.git
13+
cd codeception-module-openapi-server-mock
14+
```
15+
3. **Install dependencies**:
16+
```bash
17+
composer install
18+
```
19+
4. **Initialize GrumPHP**:
20+
GrumPHP is used to run quality checks on every commit. It should be initialized automatically, but you can run:
21+
```bash
22+
vendor/bin/grumphp git:init
23+
```
24+
25+
## 🧪 Running Tests
26+
27+
We use Codeception for our own internal testing. To run the tests, use:
28+
29+
```bash
30+
composer test
31+
```
32+
33+
This will run the acceptance tests which verify that the module correctly starts the mock server and interacts with it.
34+
35+
## 🔍 Quality Tools
36+
37+
We maintain high code quality standards. Before submitting a PR, ensure your code passes all checks:
38+
39+
- **Static Analysis**: `composer stan` (runs PHPStan at Level 8)
40+
- **Coding Standard**: `composer cs:check` (verifies PSR-12/Symfony style)
41+
- **Fixing Style**: `composer cs:fix` (automatically fixes most style issues)
42+
43+
## 📝 Pull Request Process
44+
45+
1. **Create a new branch** for your feature or bugfix:
46+
```bash
47+
git checkout -b feat/my-new-feature
48+
```
49+
2. **Commit your changes**. GrumPHP will automatically run linting and tests. If any check fails, the commit will be blocked until fixed.
50+
3. **Ensure your commit messages follow conventional commits** (e.g., `feat: ...`, `fix: ...`).
51+
4. **Push to your fork** and **submit a Pull Request** to the `main` branch of the original repository.
52+
5. **Describe your changes** in detail in the PR description. Link any related issues.
53+
54+
## ⚖️ Code of Conduct
55+
56+
By participating in this project, you agree to abide by our Code of Conduct (based on the Contributor Covenant). Please be respectful and professional in all interactions.
57+
58+
## 📜 License
59+
60+
By contributing, you agree that your contributions will be licensed under the project's [MIT License](LICENSE).

GEMINI.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Codeception Module for PHP OpenAPI Mock Server - Project Context
2+
3+
This directory contains a Codeception module designed to provide easy access to and control over the [PHP OpenAPI Mock Server](https://github.com/WebProject-xyz/php-openapi-mock-server).
4+
5+
## Project Overview
6+
7+
* **Type:** PHP Library / Codeception Module
8+
* **Purpose:** Orchestrate a standalone OpenAPI mock server during automated tests and provide high-level actions for test scenarios.
9+
* **Key Technologies:**
10+
* **Language:** PHP 8.3+ (PSR-12, Symfony, and Risky rulesets)
11+
* **Testing:** Codeception 5.x
12+
* **Process Management:** Symfony Process
13+
* **CI/CD:** GitHub Actions (configured in `.github/workflows/ci.yml`)
14+
* **Automation:** GrumPHP (commit hooks), PHP-CS-Fixer, PHPStan (Level 8)
15+
16+
## Architecture
17+
18+
The module `WebProject\Codeception\Module\OpenApiServerMock` acts as a **Helper Module**.
19+
- **Lifecycle Management:** It starts a PHP built-in server running the `openapi-mock-server` binary before the suite and stops it after.
20+
- **Auto-Detection:** It attempts to locate the mock server automatically via class reflection or directory traversal.
21+
- **Dynamic Control:** It communicates with the mock server via custom HTTP headers (`X-OpenApi-Mock-Active`, `X-OpenApi-Mock-StatusCode`, `X-OpenApi-Mock-Example`) to manipulate mock responses on the fly.
22+
- **Dependencies:** Designed to be used alongside `REST` and `PhpBrowser` modules.
23+
24+
## Building and Running
25+
26+
### Prerequisites
27+
* PHP 8.3 or higher.
28+
* Composer.
29+
30+
### Setup
31+
```bash
32+
composer install
33+
vendor/bin/codecept build # Generate Tester actions
34+
```
35+
36+
### Testing
37+
```bash
38+
composer test # Run all tests
39+
vendor/bin/codecept run Acceptance # Run acceptance tests specifically
40+
```
41+
42+
### Static Analysis and Linting
43+
```bash
44+
composer stan # Run PHPStan (Level 8)
45+
composer cs:check # Check coding standards
46+
composer cs:fix # Fix coding standards
47+
```
48+
49+
## Development Conventions
50+
51+
* **Namespaces:**
52+
* Source: `WebProject\Codeception\Module\`
53+
* Tests: `WebProject\Codeception\Module\Tests\`
54+
* **Coding Standard:** Strict adherence to PSR-12 and Symfony coding styles via PHP-CS-Fixer.
55+
* **Strict Typing:** `declare(strict_types=1);` is required in all PHP files.
56+
* **Type Safety:** PHPStan Level 8 is enforced. Avoid `mixed` where possible; use specific iterable types in PHPDoc.
57+
* **Commit Hooks:** GrumPHP runs `php-cs-fixer`, `phpstan`, and `codeception` on every commit.
58+
59+
## Key Files
60+
61+
* `src/OpenApiServerMock.php`: The main module logic.
62+
* `tests/Acceptance/MockServerCest.php`: Main acceptance tests for the module.
63+
* `codeception.yml`: Global Codeception configuration.
64+
* `phpstan.neon`: PHPStan configuration (Level 8).
65+
* `.php-cs-fixer.php`: Coding style rules.
66+
* `grumphp.yml`: Automation task definitions.

0 commit comments

Comments
 (0)