wickedone / muppet
testing your getters, setters, adders, removers, issers and whatevers
Installs: 7 641
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=7.4
- doctrine/collections: ^1.6
- nette/php-generator: ^3.6
- nikic/php-parser: ^4.13
- phpunit/phpunit: ^9.5
- roave/better-reflection: ^4.12
- symfony/finder: ^5.3
Requires (Dev)
- escapestudios/symfony2-coding-standard: ^3.12
- friendsofphp/php-cs-fixer: ^3.2
- infection/infection: ^0.26
- phpmetrics/phpmetrics: ^2.7
- phpstan/phpstan: ^0.12.99
- phpstan/phpstan-deprecation-rules: ^0.12.6
- phpstan/phpstan-php-parser: ^0.12.3
- phpstan/phpstan-phpunit: ^0.12.22
- phpstan/phpstan-strict-rules: ^0.12.11
- roave/security-advisories: dev-latest
- vimeo/psalm: ^4.12
- wickedone/phpcs-reporter: ^1.0
- wickedone/phpunit-printer: ^1.0
This package is auto-updated.
Last update: 2022-12-29 04:20:07 UTC
README
unit testing your getters, setters, adders, removers, issers and whatevers.
installation
to add this library to your dev dependencies use
composer require --dev wickedone/muppet
but why?
a lot has been written about the necessity of testing your getters and setters or why it shouldn't been done. from my personal perspective, testing getters and setters provide a stable level of coverage and thus the ability to pin your ci to a minimum coverage value.
what it does
this library doesn't promise to generate perfect, non failing tests out of the box (though it tries). it does however generate test classes which are easy to modify and, most importantly, are compatible with infection (i.e. not too much black magic fuckery).
usage
$config = new Config( '~/Code/Project/src', // base dir '~/Code/Project/tests/Unit', // tests dir // namespace fragments [ 'Awesome', 'Namespace', 'Tests', 'Unit', ], 'foo <bar@qux.com>' // author (optional) ); (new Generator($config)) ->generate('MyEntity') ;
assumptions
because we love those...
- iterable properties use adders and removers rather than setters
- removers return booleans: true on removal, false otherwise
Tests
is part of the tests namespace
symfony integration
please see the muppet-bundle