2017 © Pedro Peláez
 

yii2-extension yii2-skeletest

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)

image

insolita/yii2-skeletest

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)

  • Thursday, June 1, 2017
  • by Insolita
  • Repository
  • 1 Watchers
  • 2 Stars
  • 44 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Test Skeleton generator

Status Latest Stable Version Total Downloads License, (*1)

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template), (*2)

CHANGELOG!, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

php composer.phar require -dev --prefer-dist insolita/yii2-skeletest "~1.1"

or add, (*6)

"insolita/yii2-skeletest": "~1.1"

to the require-dev section of your composer.json file., (*7)

Usage

in console application config add to controllerMap section, (*8)

'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, (*9)

  • 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, (*10)

The Versions

01/06 2017

dev-master

9999999-dev

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

phpunit extension yii2 tests codeception

28/05 2017

1.1.0

1.1.0.0

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Insolita

phpunit extension yii2 tests codeception

01/05 2017

1.0.2

1.0.2.0

Generate test skeletons for file or whole directory with target file methods (codeception/phpunit - based on template)

  Sources   Download

MIT

The Requires

 

by Avatar Insolita

phpunit extension yii2 tests codeception