A free, self-hostable news aggregator…
tec: Add a test target to Makefile (#2725)
Marien Fressinaud6bc963569beb
diff --git a/.gitignore b/.gitignoreindex 62b1bcbdf..2fd0ee2c5 100644--- a/.gitignore+++ b/.gitignore@@ -1,3 +1,4 @@+/binconstants.local.php# Temp filesdiff --git a/Docker/Dockerfile-Alpine b/Docker/Dockerfile-Alpineindex 7d7fbee99..c538c48df 100644--- a/Docker/Dockerfile-Alpine+++ b/Docker/Dockerfile-Alpine@@ -5,7 +5,7 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"]RUN apk add --no-cache \apache2 php7-apache2 \php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \- php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-opcache php7-session php7-simplexml php7-xmlreader php7-zlib \+ php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-opcache php7-phar php7-session php7-simplexml php7-xmlreader php7-zlib \php7-pdo_sqlite php7-pdo_mysql php7-pdo_pgsqlRUN mkdir -p /var/www/FreshRSS /run/apache2/diff --git a/Makefile b/Makefileindex dcb547c7d..87b8898e9 100644--- a/Makefile+++ b/Makefile@@ -7,6 +7,18 @@ endifPORT ?= 8080PHP := $(shell sh -c 'which php')+ifdef NO_DOCKER+ PHP = php+else+ PHP = docker run \+ --rm \+ --volume $(shell pwd):/var/www/FreshRSS:z \+ --env FRESHRSS_ENV=development \+ --name freshrss-php-cli \+ freshrss/freshrss:$(TAG) \+ php+endif+ifeq ($(findstring alpine,$(TAG)),alpine)DOCKERFILE=Dockerfile-Alpineelse ifeq ($(findstring arm,$(TAG)),arm)@@ -39,6 +51,18 @@ start: ## Start the development environment (use Docker)stop: ## Stop FreshRSS container if anydocker stop freshrss-dev+###########+## Tests ##+###########+bin/phpunit: ## Install PHPUnit for test purposes+ mkdir -p bin/+ wget -O bin/phpunit https://phar.phpunit.de/phpunit-7.5.9.phar+ echo '5404288061420c3921e53dd3a756bf044be546c825c5e3556dea4c51aa330f69 bin/phpunit' | sha256sum -c - || rm bin/phpunit++.PHONY: test+test: bin/phpunit ## Run the test suite+ $(PHP) ./bin/phpunit --bootstrap ./tests/bootstrap.php ./tests+############ I18N ############diff --git a/docs/en/developers/03_Running_tests.md b/docs/en/developers/03_Running_tests.mdnew file mode 100644index 000000000..ce061cc5b--- /dev/null+++ b/docs/en/developers/03_Running_tests.md@@ -0,0 +1,25 @@+# Running tests++FreshRSS is tested with [PHPUnit](https://phpunit.de/). No code should be merged in `master` if the tests don't pass.++## Locally++As a developer, you can run the test suite on your PC easily with `make` commands. You can run the test suite with:++```console+$ make test+```++This command downloads the PHPUnit binary and verifies its checksum. If the verification fails, the file is deleted. In this case, you should [open an issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues/new) to let maintainers know about the problem.++Then, it executes PHPUnit in a Docker container. If you don't use Docker, you can run the command directly with:++```console+$ NO_DOCKER=true make test+```++## Travis++Tests are automatically run when you open a pull request on GitHub. It is done with [Travis CI](https://travis-ci.org/FreshRSS/FreshRSS/). This is done to ensure there is no regressions in your code. We cannot merge a PR if the tests fail so we'll ask you to fix bugs before to review your code.++If you're interested in, you can take a look at [the configuration file](https://github.com/FreshRSS/FreshRSS/blob/master/.travis.yml).diff --git a/docs/fr/developers/03_Running_tests.md b/docs/fr/developers/03_Running_tests.mdnew file mode 100644index 000000000..70aafc02a--- /dev/null+++ b/docs/fr/developers/03_Running_tests.md@@ -0,0 +1,35 @@+# Running tests++FreshRSS is tested with [PHPUnit](https://phpunit.de/). No code should be+merged in `master` if the tests don't pass.++## Locally++As a developer, you can run the test suite on your PC easily with `make`+commands. You can run the test suite with:++```console+$ make test+```++This command downloads the PHPUnit binary and verifies its checksum. If the+verification fails, the file is deleted. In this case, you should [open an+issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues/new) to let+maintainers know about the problem.++Then, it executes PHPUnit in a Docker container. If you don't use Docker,+you can run the command directly with:++```console+$ NO_DOCKER=true make test+```++## Travis++Tests are automatically run when you open a pull request on GitHub. It is+done with [Travis CI](https://travis-ci.org/FreshRSS/FreshRSS/). This is+done to ensure there is no regressions in your code. We cannot merge a PR if+the tests fail so we'll ask you to fix bugs before to review your code.++If you're interested in, you can take a look at [the configuration+file](https://github.com/FreshRSS/FreshRSS/blob/master/.travis.yml).diff --git a/docs/i18n/freshrss.fr.po b/docs/i18n/freshrss.fr.poindex 7a5d8d00e..a5d536670 100644--- a/docs/i18n/freshrss.fr.po+++ b/docs/i18n/freshrss.fr.po@@ -10,7 +10,7 @@ msgid ""msgstr """Project-Id-Version: FreshRSS\n""Report-Msgid-Bugs-To: https://github.com/FreshRSS/FreshRSS/issues\n"-"POT-Creation-Date: 2019-12-07 10:49+0100\n"+"POT-Creation-Date: 2019-12-29 11:00+0100\n""PO-Revision-Date: 2019-12-07 10:50+0100\n""Last-Translator: Marien Fressinaud <[email protected]>\n""Language-Team: French <>\n"@@ -378,7 +378,8 @@ msgstr ""#. type: Code fence info string#: en/./developers/01_First_steps.md:15 en/./developers/01_First_steps.md:24#: en/./developers/01_First_steps.md:34 en/./developers/01_First_steps.md:42-#: en/./developers/01_First_steps.md:50+#: en/./developers/01_First_steps.md:50 en/./developers/03_Running_tests.md:9+#: en/./developers/03_Running_tests.md:17#, no-wrapmsgid "console"msgstr "console"@@ -2983,6 +2984,90 @@ msgid """display some information, you have to create the `configure.phtml` file."msgstr ""+#. type: Title #+#: en/./developers/03_Running_tests.md:1+#, no-wrap+msgid "Running tests"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:4+msgid ""+"FreshRSS is tested with [PHPUnit](https://phpunit.de/). No code should be "+"merged in `master` if the tests don't pass."+msgstr ""++#. type: Title ##+#: en/./developers/03_Running_tests.md:5+#, no-wrap+msgid "Locally"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:8+msgid ""+"As a developer, you can run the test suite on your PC easily with `make` "+"commands. You can run the test suite with:"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:9+#, fuzzy, no-wrap+#| msgid "$ make stop\n"+msgid "$ make test\n"+msgstr "$ make stop\n"++#. type: Plain text+#: en/./developers/03_Running_tests.md:14+msgid ""+"This command downloads the PHPUnit binary and verifies its checksum. If the "+"verification fails, the file is deleted. In this case, you should [open an "+"issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues/new) to let "+"maintainers know about the problem."+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:16+msgid ""+"Then, it executes PHPUnit in a Docker container. If you don't use Docker, "+"you can run the command directly with:"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:17+#, fuzzy, no-wrap+#| msgid "$ make stop\n"+msgid "$ NO_DOCKER=true make test\n"+msgstr "$ make stop\n"++#. type: Title ##+#: en/./developers/03_Running_tests.md:21+#, no-wrap+msgid "Travis"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:24+msgid ""+"Tests are automatically run when you open a pull request on GitHub. It is "+"done with [Travis CI](https://travis-ci.org/FreshRSS/FreshRSS/). This is "+"done to ensure there is no regressions in your code. We cannot merge a PR if "+"the tests fail so we'll ask you to fix bugs before to review your code."+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:25+#, fuzzy+#| msgid ""+#| "If your request is new, [open a new bug ticket](https://github.com/"+#| "FreshRSS/FreshRSS/issues/new)"+msgid ""+"If you're interested in, you can take a look at [the configuration file]"+"(https://github.com/FreshRSS/FreshRSS/blob/master/.travis.yml)."+msgstr ""+"Si votre demande est nouvelle, [ouvrez un nouveau ticket de bug](https://"+"github.com/FreshRSS/FreshRSS/issues/new)"+#. type: Title ##: en/./developers/04_Frontend/01_View_files.md:1#, no-wrapdiff --git a/docs/i18n/templates/freshrss.pot b/docs/i18n/templates/freshrss.potindex 2dbd80cb6..bdeff8328 100644--- a/docs/i18n/templates/freshrss.pot+++ b/docs/i18n/templates/freshrss.pot@@ -8,7 +8,7 @@ msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: https://github.com/FreshRSS/FreshRSS/issues\n"-"POT-Creation-Date: 2019-12-07 10:49+0100\n"+"POT-Creation-Date: 2019-12-29 11:00+0100\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <[email protected]>\n"@@ -301,7 +301,7 @@ msgid "Once you're done, clone the repository with:"msgstr ""#. type: Code fence info string-#: en/./developers/01_First_steps.md:15 en/./developers/01_First_steps.md:24 en/./developers/01_First_steps.md:34 en/./developers/01_First_steps.md:42 en/./developers/01_First_steps.md:50+#: en/./developers/01_First_steps.md:15 en/./developers/01_First_steps.md:24 en/./developers/01_First_steps.md:34 en/./developers/01_First_steps.md:42 en/./developers/01_First_steps.md:50 en/./developers/03_Running_tests.md:9 en/./developers/03_Running_tests.md:17#, no-wrapmsgid "console"msgstr ""@@ -2381,6 +2381,82 @@ msgid """display some information, you have to create the `configure.phtml` file."msgstr ""+#. type: Title #+#: en/./developers/03_Running_tests.md:1+#, no-wrap+msgid "Running tests"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:4+msgid ""+"FreshRSS is tested with [PHPUnit](https://phpunit.de/). No code should be "+"merged in `master` if the tests don't pass."+msgstr ""++#. type: Title ##+#: en/./developers/03_Running_tests.md:5+#, no-wrap+msgid "Locally"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:8+msgid ""+"As a developer, you can run the test suite on your PC easily with `make` "+"commands. You can run the test suite with:"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:9+#, no-wrap+msgid "$ make test\n"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:14+msgid ""+"This command downloads the PHPUnit binary and verifies its checksum. If the "+"verification fails, the file is deleted. In this case, you should [open an "+"issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues/new) to let "+"maintainers know about the problem."+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:16+msgid ""+"Then, it executes PHPUnit in a Docker container. If you don't use Docker, "+"you can run the command directly with:"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:17+#, no-wrap+msgid "$ NO_DOCKER=true make test\n"+msgstr ""++#. type: Title ##+#: en/./developers/03_Running_tests.md:21+#, no-wrap+msgid "Travis"+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:24+msgid ""+"Tests are automatically run when you open a pull request on GitHub. It is "+"done with [Travis CI](https://travis-ci.org/FreshRSS/FreshRSS/). This is "+"done to ensure there is no regressions in your code. We cannot merge a PR if "+"the tests fail so we'll ask you to fix bugs before to review your code."+msgstr ""++#. type: Plain text+#: en/./developers/03_Running_tests.md:25+msgid ""+"If you're interested in, you can take a look at [the configuration "+"file](https://github.com/FreshRSS/FreshRSS/blob/master/.travis.yml)."+msgstr ""+#. type: Title ##: en/./developers/04_Frontend/01_View_files.md:1#, no-wrapdiff --git a/docs/po4a.conf b/docs/po4a.confindex 68055bb2c..98baff2c7 100644--- a/docs/po4a.conf+++ b/docs/po4a.conf@@ -10,6 +10,7 @@[type: text] en/./developers/03_Backend/03_External_libraries.md $lang:$lang/./developers/03_Backend/03_External_libraries.md opt:"-o markdown" opt:"-M utf-8"[type: text] en/./developers/03_Backend/04_Changing_source_code.md $lang:$lang/./developers/03_Backend/04_Changing_source_code.md opt:"-o markdown" opt:"-M utf-8"[type: text] en/./developers/03_Backend/05_Extensions.md $lang:$lang/./developers/03_Backend/05_Extensions.md opt:"-o markdown" opt:"-M utf-8"+[type: text] en/./developers/03_Running_tests.md $lang:$lang/./developers/03_Running_tests.md opt:"-o markdown" opt:"-M utf-8"[type: text] en/./developers/04_Frontend/01_View_files.md $lang:$lang/./developers/04_Frontend/01_View_files.md opt:"-o markdown" opt:"-M utf-8"[type: text] en/./developers/04_Frontend/02_Design.md $lang:$lang/./developers/04_Frontend/02_Design.md opt:"-o markdown" opt:"-M utf-8"[type: text] en/./developers/05_Release_new_version.md $lang:$lang/./developers/05_Release_new_version.md opt:"-o markdown" opt:"-M utf-8"