Is it possible to tell phpunit where to put gen开发者_Go百科erated test skeleton file by the --skeleton-test command? Even is it possible to tell phpunit to repeat directory structure?
Lest say i have file for testing in lib/model/SomeClass.php
and i want phpstorm to generate unit test class and put it in test/lib/model/SomeClassTest.php
without creation of all neccessary directory structure.
Thanks in advance!
Example reproduced for convenience
mkdir lib/model tests/lib/model
echo "<?php class SomeClass{}" > lib/model/SomeClass.php
Calling the code below should do the trick
phpunit --skeleton-test SomeClass library/model/SomeClass.php SomeClassTest tests/library/model/SomeClassTest.php
The arguments (only the first one being mandatory) are
$inClassName,
$inSourceFile = '',
$outClassName = '',
$outSourceFile = ''
as described in the constructor of PHPUnit_Util_Skeleton_Class
Yeah that is possible in netbeans IDE. if you configure PHPUnit(Xdebug required) with netbeans then it automatically creates file/folder structure for your framework
Netbeans link
Also it creates the skeleton for each class of Controller and module
/vendor/phpunit/phpunit-skeleton-generator/src/TestGenerator.php
In the constructor change the $outSourceFile to the path you would like the file to save to.
Cheers
精彩评论