Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/macpaw/behat-nelmio-describer
Bundle for adding sample responses behat test nelmio to api doc
https://github.com/macpaw/behat-nelmio-describer
behat macpaw nelmio swagger symfony symfony-bundle
Last synced: about 22 hours ago
JSON representation
Bundle for adding sample responses behat test nelmio to api doc
- Host: GitHub
- URL: https://github.com/macpaw/behat-nelmio-describer
- Owner: MacPaw
- License: mit
- Created: 2022-09-09T09:54:29.000Z (about 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-06-04T10:46:47.000Z (6 months ago)
- Last Synced: 2024-11-15T22:09:54.168Z (1 day ago)
- Topics: behat, macpaw, nelmio, swagger, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
Behat Nelmio Describer
=================================| Version | Build Status | Code Coverage |
|:---------:|:-------------:|:-----:|
| `master`| [![CI][master Build Status Image]][master Build Status] | [![Coverage Status][master Code Coverage Image]][master Code Coverage] |
| `develop`| [![CI][develop Build Status Image]][develop Build Status] | [![Coverage Status][develop Code Coverage Image]][develop Code Coverage] |Installation
============Step 1: Install Bundle
----------------------------------
Open a command console, enter your project directory and execute:```console
$ composer require macpaw/behat-nelmio-describer
```This command requires you to have Composer installed globally, as explained
in the [installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.Step 2: Enable the Bundle
----------------------------------
Then, enable the bundle by adding it to the list of registered bundles
in the `app/AppKernel.php` file of your project:```php
['all' => true]
);// ...
}// ...
}
```Step 3: Create Behat Nelmio Describer Config:
----------------------------------
`config/packages/behat_nelmio_describer.yaml `Configurating behat nelmio describer
```yaml
behat_nelmio_describer:
behat_test_path:
```Step 4: Add annotation to controller [OPTIONAL]
=============```php
")]
final class SomeController extends AbstractController{
// ...
}
```Step 5: Add annotation to route
=============```php
", file: '', anchors: [
// array of anchors
])]
public function handleRequestFunction() {
// ...
}
}
```For each anchor path from config, path from BehatFeaturesPath annotation (optional) and path/filename from BehatFeature annotation are concatenated to find the right feature file.
Additionally, each BehatFeature annotation represents folder in api doc which contains all sample responses defined by anchors.
An example of usage
=============If your feature file is located in `src/tests/Behat/Features/api/version/route/example.feature`
Configuration
```yaml
behat_nelmio_describer:
behat_test_path: '%kernel.project_dir%/tests/Behat/Features'
```
Used in Controller:
```php[master Build Status]: https://github.com/macpaw/behat-nelmio-describer/actions?query=workflow%3ACI+branch%3Amaster
[master Build Status Image]: https://github.com/macpaw/behat-nelmio-describer/workflows/CI/badge.svg?branch=master
[develop Build Status]: https://github.com/macpaw/behat-nelmio-describer/actions?query=workflow%3ACI+branch%3Adevelop
[develop Build Status Image]: https://github.com/macpaw/behat-nelmio-describer/workflows/CI/badge.svg?branch=develop
[master Code Coverage]: https://codecov.io/gh/macpaw/behat-nelmio-describer/branch/master
[master Code Coverage Image]: https://img.shields.io/codecov/c/github/macpaw/behat-nelmio-describer/master?logo=codecov
[develop Code Coverage]: https://codecov.io/gh/macpaw/behat-nelmio-describer/branch/develop
[develop Code Coverage Image]: https://img.shields.io/codecov/c/github/macpaw/behat-nelmio-describer/develop?logo=codecov