smartrunner
resolves dependencies between SUTs and test cases by code coverage data using phpdbg or xdebug.
- When
smartrunner
is invoked with an argumentCalcTest.php
, it runsCalcTest.php
test case. - When
smartrunner
is invoked with an argumentCalc.php
, it also runsCalcTest.php
. Additionally, it may run all test cases related toCalc.php
.
$ composer require --dev iakio/phpunit-smartrunner:dev-master
$ vendor/bin/smartrunner init
This creates .smartrunner/phpunit.xml.dist
file. If you already have
some test codes, and you want to store all dependencies between
SUTs and tests certainly, you can run phpunit with this file.
$ vendor/bin/phpunit -c .smartrunner/phpunit.xml.dist tests
Then, run smartrunner from your favorite IDE, editor or filesystem watcher.
$ vendor/bin/smartrunner run src/Calc.php
> gomon -m=\.php$ -R -F -- vendor\bin\smartrunner run
$ watchy -w . -- bash -c 'vendor/bin/smartrunner run $FILE'
or
> watchy -w . -- cmd /C "vendor\bin\smartrunner run %FILE%"
module.exports = function (grunt) {
grunt.initConfig({
shell: {
smartrunner: {
file: "",
command: function () {
return "vendor/bin/smartrunner run " +
grunt.config.get('shell.smartrunner.file');
}
}
},
esteWatch: {
options: {
dirs: [
'src/**/',
'tests/**/',
]
},
php: function (filePath) {
grunt.config("shell.smartrunner.file", filePath);
return ['shell:smartrunner'];
},
},
});
grunt.loadNpmTasks('grunt-este-watch');
grunt.loadNpmTasks('grunt-shell');
};
If you want to use phpunit.phar
, change your .smartrunner/config.php
:
<?php
return function ($config) {
$config["phpunit"] = "php phpunit.phar";
$config["ignore"] = [
"vendor\/**\/*"
];
};
- php >= 5.4
- phpdbg or xdebug
This software is released under the MIT License.