Wallogit.com
2017 © Pedro Peláez
Can create test fot controllers and models
Instalation via composer, (*1)
```` composer require hemink/testgen, (*2)
Create config file in root folder of project with name testgen.conf.php Go to
vendor/hemink/testgen, (*3)
Run
php testgen.php controllers, (*4)
or
php testgen.php models, (*5)
for tests generation. Config file example testgen.conf.php
<?php return [ 'rootDir' => DIR,//root dir of project 'testsFolder' => DIR . DIRECTORY_SEPARATOR . "tests/codeception", 'testsNamespace' => 'tests\codeception', 'AcceptanceTesterFullName' => '', 'namespaces' => [ 'dektrium\user\models\User' => 'dektrium/yii2-user/models/User', 'dektrium\user\traits\ModuleTrait' => 'dektrium/yii2-user/traits/ModuleTrait', ], 'controllers' => [ 'keyWord' => 'Controller',//contained in each file name 'paths' => [//set if controller not in module folder // 'module/Users/src/Users/Controller', ], 'except' =>[//except controllers '.gitkeep', 'SaleController.php', 'BookingController.php', ], 'exceptActions' => [ 'beforeActions',//for action in all controllers 'frontend\controllers\ProductController' => [ 'actionIndex',//for actions in certain controller ], ],, (*6)
'route' => [
'type' => 'zf2',//or simple
//if you use simple the path is not needed
'paths' => [
__DIR__ . '/module/Users/config/module.config.php',
__DIR__ . '/module/Calendar/config/module.config.php',
],
],
'route' => [
'type' => 'zf2',//or 'simple'
//if you use 'simple' the path is not needed
'modules' => __DIR__ . DIRECTORY_SEPARATOR . 'module',
'paths' => [//for define cusrom paths to routs config
__DIR__ . DIRECTORY_SEPARATOR . 'module/Users/config/module.config.php',
__DIR__ . DIRECTORY_SEPARATOR . 'module/Calendar/config/module.config.php',
],
],
],
'models' => [
'keyWord' => '.',
'paths' => [
'common/models/table',
],
'except' => [
'BookingSearch.php',
'CategorySearch.php',
'ProductSearch.php',
'UserSearch.php',
],
],
];, (*7)