Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-04-17 (4 months ago) | Not enough user ratings | Total: 17 | All time: 11,328 This week: 73 |
Version | License | PHP version | Categories | |||
yii2-skeletest 1.0 | MIT/X Consortium ... | 5 | PHP 5, Console, Code Generation, Testing |
Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)
The preferred way to install this extension is through composer.
Either run
php composer.phar require -dev --prefer-dist insolita/yii2-skeletest "~1.1"
or add
"insolita/yii2-skeletest": "~1.1"
to the require-dev section of your composer.json
file.
in console application config add to controllerMap section
'skeletest'=>[
'class'=>\insolita\skeletest\controllers\SkeletestController::class,
'apps' => [
//register each application with own test directory - for basic template like this
'app'=>[
'appPath' => '@app/',
'testPath' => '@app/tests/codeception/unit',
'testNs' => 'tests\codeception\unit',
'testerNs' => 'tests\codeception\UnitTester', //optional
]
],
'app'=>'app',//default application key
'templateFile' => '@vendor/insolita/yii2-skeletest/templates/codeception.php', //or own template
'overwrite' => false, //overwrite existed test
'ignoreGetters' => true, //skip getter methods
'ignoreSetters' => true, //skip setter methods
'withProtectedMethods' => false, //include protected methods in test skeleton
'withPrivateMethods' => false,//include private methods in test skeleton
'withStaticMethods' => true,//include static methods in test skeleton
'ignoreFilePatterns'=>['~(controllers|widget|asset|interface|contract|migration)~i'],//array of regexp patterns for skip files
'ignoreMethodPatterns'=>['~^(behaviors|find|rules|tableName|attributeLabels|scenarios)$~'],//array of regexp patterns for skip methods
],
after configuration you can use it in console
generate single test by file alias
./yii skeletest @app/components/MyComponent.php
generate tests recursive for all files by directory alias (Be careful, if directory contains sub-directory with non-psr namespace roots, for that directories you must generate test directly)
./yii skeletest/dir @frontend/services/registration --app=front
show options
./yii help skeletest/file
Template customization
----------------------
Copy @vendor/insolita/yii2-skeletest/templates/codeception.php in any project directory and modify as you want
Change in controllerMap 'templateFile' parameter of skeletest controller to you own template path
Share in issue usefull template variants
Files (22) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file, 4 directories) | ||||
tests (4 files, 2 directories) | ||||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (22) | / | src |
File | Role | Description | ||
---|---|---|---|---|
controllers (1 file) | ||||
entity (2 files) | ||||
services (2 files) | ||||
templates (2 files) | ||||
AccessibleMethodTrait.php | Class | Class source |
Files (22) | / | src | / | entity |
File | Role | Description |
---|---|---|
AppConfig.php | Class | Class source |
FileClass.php | Class | Class source |
Files (22) | / | src | / | services |
File | Role | Description |
---|---|---|
ReflectionService.php | Class | Class source |
SkeletestService.php | Class | Class source |
Files (22) | / | src | / | templates |
File | Role | Description |
---|---|---|
codeception.php | Example | Example script |
codeception2.php | Example | Example script |
Files (22) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
config (2 files) | ||||
unit (3 files) | ||||
.env | Data | Auxiliary data | ||
bootstrap.php | Example | Example script | ||
unit.suite.yml | Data | Auxiliary data | ||
yii | Example | Example script |
Files (22) | / | tests | / | config |
File | Role | Description |
---|---|---|
base.php | Class | Class source |
console.php | Aux. | Auxiliary script |
Files (22) | / | tests | / | unit |
File | Role | Description |
---|---|---|
bootstrap.php | Aux. | Auxiliary script |
ReflectionServiceTest.php | Class | Class source |
SkeletestServiceTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.