Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kristijorgji/php-test-generator
Generate php boilerplate for unit tests
https://github.com/kristijorgji/php-test-generator
Last synced: about 1 month ago
JSON representation
Generate php boilerplate for unit tests
- Host: GitHub
- URL: https://github.com/kristijorgji/php-test-generator
- Owner: kristijorgji
- License: mit
- Created: 2018-06-19T09:06:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-19T10:25:09.000Z (over 6 years ago)
- Last Synced: 2024-04-20T02:03:22.686Z (8 months ago)
- Language: PHP
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-test-generator
A framework for generating test boilerplate from the specified suites.
# Table of Contents
- [Installation](#installation)
- [Config](#config)## Installation
```sh
composer require kristijorgji/php-test-generator
```Run the following command to initialize phpTestGenerator
```sh
vendor/bin/phpTestGenerator init
```
This command will create in your project root folder the config file `phpTestGenerator.cfg.php`
You need to edit that to your desired settings.## Config
The config and it's keys try to be as much self explanatory as possible.
Example config:```php
[
'code' => [
'sourcesPath' => 'app',
'excludePatterns' => [
'Console',
'Constants',
'#.*Interface\.php$#',
'#.*Exception\.php$#',
],
'outputDirectory' => 'tests/unit/app',
'namespace' => 'UnitTests',
'extends' => '\Tests\Helpers\TestCase'
],
'database' => [
'sourcesPath' => 'app/Repositories',
'excludePatterns' => [
'Contracts'
],
'outputDirectory' => 'tests/unit/app/Repositories',
'namespace' => 'UnitTests\App\Repositories',
'extends' => 'Tests\Helpers\FixtureTestCase'
],
]
];
```The exclude patterns can be directory names (relative to suite source paths), or regular expressions.
In the former case, the pattern should be defined within #, like in the example config.## License
php-test-generator is released under the MIT Licence. See the bundled LICENSE file for details.