From 2fd317504c94ca742a9a0ec8aae4ad8519db1638 Mon Sep 17 00:00:00 2001 From: RomainMazB Date: Mon, 18 Oct 2021 11:21:53 +0200 Subject: [PATCH 1/4] Add winter:test command --- console-commands.md | 25 +++++++++++++++++++++++++ help-unit-testing.md | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/console-commands.md b/console-commands.md index 8d4ed49f..3a6a7021 100644 --- a/console-commands.md +++ b/console-commands.md @@ -310,3 +310,28 @@ Deletes records in "system_files" table that do not belong to any other model. To also delete records that have no associated file in the local storage, pass the `--missing-files` option. php artisan winter:util purge orphans --missing-files + + +#### Run unit tests + +Runs the core's, a specified plugin's or all the project's unit tests. + +All the project's tests: + + php artisan winter:test + +Only the core's tests with the `--o|-core` option: + + php artisan winter:test --o + +Only the specified plugin's tests with the `--p|-plugin=` option: + + php artisan winter:test --p Acme.Demo + +Only a specified custom Test Suite with the `--c|-configuration=` option: + + php artisan winter:test --c ./custom-path/phpunit.xml + +You can pass any of the PHP Unit options as long as you type them **after** the `winter:test` command's options: + + php artisan winter:test --p Acme.Demo --filter=FilteredTest --stop-on-failure diff --git a/help-unit-testing.md b/help-unit-testing.md index 09088dea..0579e4dd 100644 --- a/help-unit-testing.md +++ b/help-unit-testing.md @@ -6,7 +6,7 @@ ## Testing plugins -Individual plugin test cases can be run by running `../../../vendor/bin/phpunit` in the plugin's base directory (ex. `plugins/acme/demo`. +Individual plugin test cases can be run by running [the `winter:test`](./console/commands/#winter-test) command with the `--p|plugin=` option. ### Creating plugin tests @@ -102,7 +102,7 @@ To perform unit testing on the core Winter files, you should download a developm ### Unit tests -Unit tests can be performed by running `vendor/bin/phpunit` in the root directory of your Winter CMS installation. +Unit tests can be performed by running [the `winter:test`](./console/commands/#winter-test) command with the `--o|-core` option. ### Functional tests From bd6e4640243526f2d67727ccb3e051391fb63e48 Mon Sep 17 00:00:00 2001 From: Romain 'Maz' BILLOIR Date: Mon, 18 Oct 2021 11:38:29 +0200 Subject: [PATCH 2/4] Fix double-dashes typo --- console-commands.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/console-commands.md b/console-commands.md index 3a6a7021..ed3c84ae 100644 --- a/console-commands.md +++ b/console-commands.md @@ -322,16 +322,16 @@ All the project's tests: Only the core's tests with the `--o|-core` option: - php artisan winter:test --o + php artisan winter:test -o Only the specified plugin's tests with the `--p|-plugin=` option: - php artisan winter:test --p Acme.Demo + php artisan winter:test -p Acme.Demo Only a specified custom Test Suite with the `--c|-configuration=` option: - php artisan winter:test --c ./custom-path/phpunit.xml + php artisan winter:test -c ./custom-path/phpunit.xml You can pass any of the PHP Unit options as long as you type them **after** the `winter:test` command's options: - php artisan winter:test --p Acme.Demo --filter=FilteredTest --stop-on-failure + php artisan winter:test -p Acme.Demo --filter=FilteredTest --stop-on-failure From d38e2b1f714b0bf842a60c7bc10fc7c1452ca170 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 19 Oct 2021 16:13:29 +0800 Subject: [PATCH 3/4] Apply suggestions from code review --- console-commands.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/console-commands.md b/console-commands.md index ed3c84ae..52ee1bf5 100644 --- a/console-commands.md +++ b/console-commands.md @@ -314,24 +314,24 @@ To also delete records that have no associated file in the local storage, pass t #### Run unit tests -Runs the core's, a specified plugin's or all the project's unit tests. +Runs the unit tests for the core, a specified plugin or across the entire project. -All the project's tests: +To run the entire project's unit tests: php artisan winter:test -Only the core's tests with the `--o|-core` option: +Or, to run only the core unit tests, use the `-o|--core` option: php artisan winter:test -o -Only the specified plugin's tests with the `--p|-plugin=` option: +To run a specified plugin's tests, use the `-p|--plugin=` option: php artisan winter:test -p Acme.Demo -Only a specified custom Test Suite with the `--c|-configuration=` option: +To run a custom test suite, use the `-c|--configuration=` option: php artisan winter:test -c ./custom-path/phpunit.xml -You can pass any of the PHP Unit options as long as you type them **after** the `winter:test` command's options: +You can pass any additional parameters to PHPUnit, as long as you include them **after** the `winter:test` command's options: php artisan winter:test -p Acme.Demo --filter=FilteredTest --stop-on-failure From bf5f1e885ffdec5dec00129d013604695e3529de Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Tue, 19 Oct 2021 13:12:05 -0600 Subject: [PATCH 4/4] Apply suggestions from code review --- console-commands.md | 21 +++------------------ help-unit-testing.md | 4 ++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/console-commands.md b/console-commands.md index 52ee1bf5..9c842a41 100644 --- a/console-commands.md +++ b/console-commands.md @@ -314,24 +314,9 @@ To also delete records that have no associated file in the local storage, pass t #### Run unit tests -Runs the unit tests for the core, a specified plugin or across the entire project. +Runs the unit tests for the entire project, a specific plugin, or the Winter CMS core. To run the entire project's unit tests: - php artisan winter:test - -Or, to run only the core unit tests, use the `-o|--core` option: - - php artisan winter:test -o - -To run a specified plugin's tests, use the `-p|--plugin=` option: - - php artisan winter:test -p Acme.Demo - -To run a custom test suite, use the `-c|--configuration=` option: - - php artisan winter:test -c ./custom-path/phpunit.xml - -You can pass any additional parameters to PHPUnit, as long as you include them **after** the `winter:test` command's options: - - php artisan winter:test -p Acme.Demo --filter=FilteredTest --stop-on-failure +```bash +php artisan winter:test diff --git a/help-unit-testing.md b/help-unit-testing.md index 0579e4dd..de63f5e6 100644 --- a/help-unit-testing.md +++ b/help-unit-testing.md @@ -6,7 +6,7 @@ ## Testing plugins -Individual plugin test cases can be run by running [the `winter:test`](./console/commands/#winter-test) command with the `--p|plugin=` option. +Individual plugin test cases can be run by running [the `winter:test` command](./console/commands/#winter-test) with the `--p|plugin=` option. ### Creating plugin tests @@ -102,7 +102,7 @@ To perform unit testing on the core Winter files, you should download a developm ### Unit tests -Unit tests can be performed by running [the `winter:test`](./console/commands/#winter-test) command with the `--o|-core` option. +Unit tests can be performed by running [the `winter:test` command](./console/commands/#winter-test) with the `--o|-core` option. ### Functional tests