diff --git a/.gitignore b/.gitignore index 55d9dd3913..957307d541 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ cypress/videos cypress/snapshots cypress/downloads -js/*hot-update.* \ No newline at end of file +js/*hot-update.* +tests/.phpunit.result.cache diff --git a/composer.json b/composer.json index cf8cad5b44..fa8ab37f69 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", "psalm:clear": "psalm.phar --clear-cache && psalm --clear-global-cache", "psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", - "test:unit": "echo 'Only testing installation of the app'" + "test:unit": "vendor/bin/phpunit -c tests/phpunit.xml --color --fail-on-warning --fail-on-risky" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8", diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000000..b3f435f93f --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,23 @@ +addValidRoot(OC::$SERVERROOT . '/tests'); + +// Fix for "Autoload path not allowed: .../photos/tests/testcase.php" +\OC_App::loadApp('photos'); + +if (!class_exists('\PHPUnit\Framework\TestCase')) { + require_once('PHPUnit/Autoload.php'); +} + +OC_Hook::clear(); diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 0000000000..3e7c2ec9c1 --- /dev/null +++ b/tests/phpunit.xml @@ -0,0 +1,13 @@ + + + + . + + +