grunt
및 몇 가지 플러그인 (있는 경우)을 사용하여이를 수행 할 수 있습니다. PHP, 자바 스크립트 및 CSS 소스 파일에 대해이 작업을 수행합니다.
예 gruntfile, 아래로 손질 :
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
grunt: { files: ['Gruntfile.js'] },
php: {
files: ['src/**/*.php'],
tasks: ['phpunit']
}
},
shell: {
phpunit: 'phpunit --testsuite Unit' // or whatever
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('phpunit', ['shell:phpunit']);
};
는 이제 src/
변경 내에서 언제든지 PHP 파일을 phpunit
를 실행 grunt-contrib-watch 및
이 grunt-shell 필요합니다 제공 는 당신은 grunt watch
작업이 백그라운드에서 실행. 물론 시계 작업의 파일 섹션에서 정규식 패턴을 사용하여 듣고 자하는 파일을 제한하고 변경할 수 있습니다.
편집 : 라기보다 특정 파일 변경에 따라 특정 테스트를 실행하려면
와일드 카드 업데이트 - 모든, 당신은 다음과 같은 것이다 :
watch: {
grunt: { files: ['Gruntfile.js'] },
UserSrc: {
files: ['app/**/UserController.php'], // The ** matches any no. of subdirs
tasks: ['UserControllerTests']
}
},
shell: {
userTests: 'phpunit tests/User' // To run all tests within a directory, or:
//userTests: 'phpunit --testsuite UserController // to run by testsuite
}
}
// ... Other config
grunt.registerTask('UserControllerTests', ['shell:userTests']);
// ... more tasks
사용하여 테스트 스위트가 더 낫다 사용자 테스트가 여러 디렉토리에 걸쳐있는 경우 사용할 경로. 따라서 테스트/사용자 및 테스트/인증 등의 모든 테스트 파일을 실행하려면 phpunit.xml 파일에 testsuite가 있어야합니다. 같은 뭔가 :
// ...
<testsuite name="UserController">
<directory suffix="Test.php">tests/Users</directory>
<directory suffix="Test.php">tests/Auth</directory>
// .. Other directories
</testsuite>
// ...
cron 작업은 사용할 수 있지만이 농가 사용하여 개발 환경에서이 작업을 수행 할 방법 최소 주파수는 분 –
당입니까? 예제에 대한 링크는 크게 –
으로 알 수 있습니다. 다른 곳에서는 cron 작업을 설정하는 것과 같은 방식으로 말할 수 있습니다. –