add phpunit

This commit is contained in:
Yuri Kuznetsov
2020-04-02 17:13:34 +03:00
parent 4c3b4017eb
commit 28c77b2890
4 changed files with 1715 additions and 194 deletions

View File

@@ -21,10 +21,11 @@
/**
* * `grunt` - full build
* * `grunt dev` - build only items needed for development
* * `grunt offline` - skips *composer install*
* * `grunt dev` - build only items needed for development (takes less time)
* * `grunt offline` - build but skip *composer install*
* * `grant release` - full build plus upgrade packages`
* * `grant tests` - build and run tests
* * `grant test` - build for test running
* * `grant run-tests` - build and run unit and integratino tests
*/
module.exports = function (grunt) {
@@ -311,12 +312,12 @@ module.exports = function (grunt) {
cp.execSync("node diff --all --vendor", {stdio: 'inherit'});
});
grunt.registerTask("unit-tests", function() {
cp.execSync("phpunit --bootstrap=vendor/autoload.php tests/unit", {stdio: 'inherit'});
grunt.registerTask("unit-tests-run", function() {
cp.execSync("vendor/bin/phpunit --bootstrap=vendor/autoload.php tests/unit", {stdio: 'inherit'});
});
grunt.registerTask("integration-tests", function() {
cp.execSync("phpunit --bootstrap=vendor/autoload.php tests/integration", {stdio: 'inherit'});
grunt.registerTask("integration-tests-run", function() {
cp.execSync("vendor/bin/phpunit --bootstrap=vendor/autoload.php tests/integration", {stdio: 'inherit'});
});
grunt.registerTask("zip", function() {
@@ -386,15 +387,29 @@ module.exports = function (grunt) {
'clean:release',
]);
grunt.registerTask('tests', [
grunt.registerTask('run-tests', [
'test',
'unit-tests-run',
'integration-tests-run',
]);
grunt.registerTask('run-unit-tests', [
'composer-dev',
'offline',
'unit-tests',
'integration-tests',
'unit-tests-run',
]);
grunt.registerTask('run-integration-tests', [
'test',
'integration-tests-run',
]);
grunt.registerTask('dev', [
'composer-dev',
'less',
]);
grunt.registerTask('test', [
'composer-dev',
'offline',
]);
};

View File

@@ -72,18 +72,22 @@ Branches:
### Running tests (for developers)
You need to have *phpunit* installed.
Before running tests, you need to build for testing:
```
grunt test
```
Unit tests:
```
phpunit --bootstrap=vendor/autoload.php tests/unit
vendor/bin/phpunit --bootstrap=vendor/autoload.php tests/unit
```
Integration tests:
```
phpunit --bootstrap=vendor/autoload.php tests/integration
vendor/bin/phpunit --bootstrap=vendor/autoload.php tests/integration
```
### How to make a translation

View File

@@ -40,6 +40,9 @@
"robthree/twofactorauth": "^1.6",
"nesbot/carbon": "^2.26"
},
"require-dev": {
"phpunit/phpunit": "^8"
},
"autoload": {
"psr-0": {
"": "application/",

1859
composer.lock generated

File diff suppressed because it is too large Load Diff