diff --git a/.gitattributes b/.gitattributes index ad12d4812f..822b7f047f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,7 @@ scripts/ export-ignore src/Standards/**/Tests/ export-ignore tests/Core/**/ export-ignore -tests/EndToEnd/**/ export-ignore +tests/EndToEndBash/**/ export-ignore .cspell.json export-ignore .gitattributes export-ignore .gitignore export-ignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 945d306246..36e467efa7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -405,13 +405,13 @@ To install bashunit, follow the [installation guide](https://bashunit.typeddevs. You can then run the bashunit tests on Linux/Mac/WSL, like so: ```bash -./lib/bashunit -p tests/EndToEnd +./lib/bashunit -p tests/EndToEndBash ``` > Note: these tests will not run in the Windows native CMD shell. When on Windows, either use WSL or use the "git bash" shell. When writing end-to-end tests, please use fixtures for the "files under scan" to make the tests stable. -These fixtures can be placed in the `tests/EndToEnd/Fixtures` subdirectory. +These fixtures can be placed in the `tests/EndToEndBash/Fixtures` subdirectory. ### Submitting Your Pull Request diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index d301978759..71e6c01159 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -57,4 +57,4 @@ jobs: - name: "Run bashunit tests" shell: bash - run: "./lib/bashunit -p tests/EndToEnd" + run: "./lib/bashunit -p tests/EndToEndBash" diff --git a/.gitignore b/.gitignore index 5a6fc39651..905b9e9435 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ vendor/ /tests/Standards/sniffStnd.xml /tests/Core/Util/ExitCode/Fixtures/ExitCodeTest/*.fixed /tests/Core/Util/ExitCode/Fixtures/ExitCodeTest/phpcs.cache -/tests/EndToEnd/Fixtures/*.fixed +/tests/EndToEndBash/Fixtures/*.fixed diff --git a/.shellcheckrc b/.shellcheckrc index 12a6cd5c3a..32757852ec 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -2,4 +2,4 @@ shell=bash color=always external-sources=false -source-path=/tests/EndToEnd +source-path=/tests/EndToEndBash diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 8f73c7b5f0..f1dde6906d 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -13,7 +13,7 @@ */src/Standards/*/Tests/*\.inc$ */tests/Core/*/*\.inc$ */tests/Core/*/Fixtures/*\.php$ - */tests/EndToEnd/Fixtures/*\.inc$ + */tests/EndToEndBash/Fixtures/*\.inc$ diff --git a/tests/EndToEnd/exit_code_test.sh b/tests/EndToEnd/exit_code_test.sh deleted file mode 100644 index ced50e0a2f..0000000000 --- a/tests/EndToEnd/exit_code_test.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -function tear_down() { - rm -f tests/EndToEnd/Fixtures/*.fixed -} - -function test_phpcs_exit_code_clean_file() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc - assert_exit_code 0 -} -function test_phpcs_exit_code_clean_stdin() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc - assert_exit_code 0 -} -function test_phpcbf_exit_code_clean_file() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc - assert_exit_code 0 -} -function test_phpcbf_exit_code_clean_stdin() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc - assert_exit_code 0 -} - -function test_phpcs_exit_code_fixable_file() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc - assert_exit_code 1 -} -function test_phpcs_exit_code_fixable_stdin() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithStyleError.inc - assert_exit_code 1 -} -function test_phpcbf_exit_code_fixable_file() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc - assert_exit_code 0 -} -function test_phpcbf_exit_code_fixable_stdin() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithStyleError.inc - assert_exit_code 0 -} - -function test_phpcs_exit_code_non_fixable_file() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc - assert_exit_code 2 -} -function test_phpcs_exit_code_non_fixable_stdin() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc - assert_exit_code 2 -} -function test_phpcbf_exit_code_non_fixable_file() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc - assert_exit_code 2 -} -function test_phpcbf_exit_code_non_fixable_stdin() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc - assert_exit_code 2 -} - -function test_phpcs_exit_code_fixable_and_non_fixable_file() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc - assert_exit_code 3 -} -function test_phpcs_exit_code_fixable_and_non_fixable_stdin() { - bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc - assert_exit_code 3 -} -function test_phpcbf_exit_code_fixable_and_non_fixable_file() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc - assert_exit_code 2 -} -function test_phpcbf_exit_code_fixable_and_non_fixable_stdin() { - bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc - assert_exit_code 2 -} diff --git a/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc b/tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc similarity index 86% rename from tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc rename to tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc index fadd465bb7..3d7e147619 100644 --- a/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc +++ b/tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc @@ -7,7 +7,7 @@ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ -namespace PHP_CodeSniffer\Tests\EndToEnd\Fixtures; +namespace PHP_CodeSniffer\Tests\EndToEndBash\Fixtures; class ClassOneWithoutStyleError { diff --git a/tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc b/tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc similarity index 85% rename from tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc rename to tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc index 7798646a27..d08e7f7f1b 100644 --- a/tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc +++ b/tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc @@ -7,7 +7,7 @@ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ -namespace PHP_CodeSniffer\Tests\EndToEnd\Fixtures; +namespace PHP_CodeSniffer\Tests\EndToEndBash\Fixtures; class ClassTwoWithoutStyleError { diff --git a/tests/EndToEnd/Fixtures/ClassWithStyleError.inc b/tests/EndToEndBash/Fixtures/ClassWithStyleError.inc similarity index 89% rename from tests/EndToEnd/Fixtures/ClassWithStyleError.inc rename to tests/EndToEndBash/Fixtures/ClassWithStyleError.inc index 18051d752b..dbcdb3377b 100644 --- a/tests/EndToEnd/Fixtures/ClassWithStyleError.inc +++ b/tests/EndToEndBash/Fixtures/ClassWithStyleError.inc @@ -7,7 +7,7 @@ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ -namespace PHP_CodeSniffer\Tests\EndToEnd\Fixtures; +namespace PHP_CodeSniffer\Tests\EndToEndBash\Fixtures; class ClassWithStyleError { diff --git a/tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc b/tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc similarity index 89% rename from tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc rename to tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc index 7ea04b6d3b..65b0e8cfdd 100644 --- a/tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc +++ b/tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc @@ -7,7 +7,7 @@ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ -namespace PHP_CodeSniffer\Tests\EndToEnd\Fixtures; +namespace PHP_CodeSniffer\Tests\EndToEndBash\Fixtures; // The brace on the following line should be on a line by itself. This can be fixed with phpcbf. class ClassWithTwoStyleErrors { diff --git a/tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc b/tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc similarity index 85% rename from tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc rename to tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc index 1380a6f0be..cb20ddf101 100644 --- a/tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc +++ b/tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc @@ -7,7 +7,7 @@ * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ -namespace PHP_CodeSniffer\Tests\EndToEnd\Fixtures; +namespace PHP_CodeSniffer\Tests\EndToEndBash\Fixtures; class ClassWithUnfixableStyleError { diff --git a/tests/EndToEnd/Fixtures/endtoend.xml.dist b/tests/EndToEndBash/Fixtures/endtoend.xml.dist similarity index 100% rename from tests/EndToEnd/Fixtures/endtoend.xml.dist rename to tests/EndToEndBash/Fixtures/endtoend.xml.dist diff --git a/tests/EndToEndBash/exit_code_test.sh b/tests/EndToEndBash/exit_code_test.sh new file mode 100644 index 0000000000..e6ff8b1f9e --- /dev/null +++ b/tests/EndToEndBash/exit_code_test.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +function tear_down() { + rm -f tests/EndToEndBash/Fixtures/*.fixed +} + +function test_phpcs_exit_code_clean_file() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc + assert_exit_code 0 +} +function test_phpcs_exit_code_clean_stdin() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc + assert_exit_code 0 +} +function test_phpcbf_exit_code_clean_file() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc + assert_exit_code 0 +} +function test_phpcbf_exit_code_clean_stdin() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc + assert_exit_code 0 +} + +function test_phpcs_exit_code_fixable_file() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithStyleError.inc + assert_exit_code 1 +} +function test_phpcs_exit_code_fixable_stdin() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithStyleError.inc + assert_exit_code 1 +} +function test_phpcbf_exit_code_fixable_file() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithStyleError.inc + assert_exit_code 0 +} +function test_phpcbf_exit_code_fixable_stdin() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithStyleError.inc + assert_exit_code 0 +} + +function test_phpcs_exit_code_non_fixable_file() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc + assert_exit_code 2 +} +function test_phpcs_exit_code_non_fixable_stdin() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc + assert_exit_code 2 +} +function test_phpcbf_exit_code_non_fixable_file() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc + assert_exit_code 2 +} +function test_phpcbf_exit_code_non_fixable_stdin() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithUnfixableStyleError.inc + assert_exit_code 2 +} + +function test_phpcs_exit_code_fixable_and_non_fixable_file() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc + assert_exit_code 3 +} +function test_phpcs_exit_code_fixable_and_non_fixable_stdin() { + bin/phpcs --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc + assert_exit_code 3 +} +function test_phpcbf_exit_code_fixable_and_non_fixable_file() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc + assert_exit_code 2 +} +function test_phpcbf_exit_code_fixable_and_non_fixable_stdin() { + bin/phpcbf --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist < tests/EndToEndBash/Fixtures/ClassWithTwoStyleErrors.inc + assert_exit_code 2 +} diff --git a/tests/EndToEnd/outofmemory_test.sh b/tests/EndToEndBash/outofmemory_test.sh similarity index 84% rename from tests/EndToEnd/outofmemory_test.sh rename to tests/EndToEndBash/outofmemory_test.sh index 01e66cccc0..e1ef1c97e9 100644 --- a/tests/EndToEnd/outofmemory_test.sh +++ b/tests/EndToEndBash/outofmemory_test.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash function tear_down() { - rm -f tests/EndToEnd/Fixtures/*.fixed + rm -f tests/EndToEndBash/Fixtures/*.fixed } function test_phpcs_out_of_memory_error_handling() { - OUTPUT="$( { bin/phpcs -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/; } 2>&1)" + OUTPUT="$( { bin/phpcs -d memory_limit=4M --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/; } 2>&1)" # The exact exit code is not our concern, just that it's non-zero. assert_unsuccessful_code @@ -15,7 +15,7 @@ function test_phpcs_out_of_memory_error_handling() { } function test_phpcbf_out_of_memory_error_handling() { - OUTPUT="$( { bin/phpcbf -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ --suffix=.fixed; } 2>&1)" + OUTPUT="$( { bin/phpcbf -d memory_limit=4M --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ --suffix=.fixed; } 2>&1)" # The exact exit code is not our concern, just that it's non-zero. assert_unsuccessful_code diff --git a/tests/EndToEnd/phpcbf_test.sh b/tests/EndToEndBash/phpcbf_test.sh similarity index 56% rename from tests/EndToEnd/phpcbf_test.sh rename to tests/EndToEndBash/phpcbf_test.sh index 4343f1eaa9..95a304766f 100644 --- a/tests/EndToEnd/phpcbf_test.sh +++ b/tests/EndToEndBash/phpcbf_test.sh @@ -1,25 +1,25 @@ #!/usr/bin/env bash function tear_down() { - rm -rf tests/EndToEnd/Fixtures/*.fixed + rm -f tests/EndToEndBash/Fixtures/*.fixed } function test_phpcbf_is_working() { - OUTPUT="$( { bin/phpcbf --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc; } 2>&1 )" + OUTPUT="$( { bin/phpcbf --no-cache --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc; } 2>&1 )" assert_successful_code assert_contains "No violations were found" "$OUTPUT" } function test_phpcbf_is_working_in_parallel() { - OUTPUT="$( { bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc; } 2>&1 )" + OUTPUT="$( { bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc; } 2>&1 )" assert_successful_code assert_contains "No violations were found" "$OUTPUT" } function test_phpcbf_returns_error_on_issues() { - OUTPUT="$( { bin/phpcbf --no-colors --parallel=1 --no-cache --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc; } 2>&1 )" + OUTPUT="$( { bin/phpcbf --no-colors --parallel=1 --no-cache --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithStyleError.inc; } 2>&1 )" assert_successful_code assert_contains "F 1 / 1 (100%)" "$OUTPUT" @@ -27,7 +27,7 @@ function test_phpcbf_returns_error_on_issues() { } function test_phpcbf_progressbar_shows_fixes_with_parallel_on() { - OUTPUT="$( { bin/phpcbf --no-colors --parallel=10 --no-cache --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc; } 2>&1 )" + OUTPUT="$( { bin/phpcbf --no-colors --parallel=10 --no-cache --suffix=.fixed --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithStyleError.inc; } 2>&1 )" assert_successful_code assert_contains "F 1 / 1 (100%)" "$OUTPUT" @@ -37,9 +37,9 @@ function test_phpcbf_bug_1112() { # See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112 if [[ "$(uname)" == "Darwin" ]]; then # Perform some magic with `& fg` to prevent the processes from turning into a background job. - assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" else # This is not needed on Linux / GitHub Actions - assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc"')" + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc"')" fi } diff --git a/tests/EndToEnd/phpcs_test.sh b/tests/EndToEndBash/phpcs_test.sh similarity index 56% rename from tests/EndToEnd/phpcs_test.sh rename to tests/EndToEndBash/phpcs_test.sh index dcc643b03b..503bed292e 100644 --- a/tests/EndToEnd/phpcs_test.sh +++ b/tests/EndToEndBash/phpcs_test.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash function test_phpcs_is_working() { - assert_successful_code "$(bin/phpcs --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" + assert_successful_code "$(bin/phpcs --no-cache --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc)" } function test_phpcs_is_working_in_parallel() { - assert_successful_code "$(bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" + assert_successful_code "$(bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc)" } function test_phpcs_returns_error_on_issues() { - OUTPUT="$( { bin/phpcs --no-colors --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc; } 2>&1 )" + OUTPUT="$( { bin/phpcs --no-colors --no-cache --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassWithStyleError.inc; } 2>&1 )" assert_exit_code 1 assert_contains "E 1 / 1 (100%)" "$OUTPUT" @@ -20,9 +20,9 @@ function test_phpcs_bug_1112() { # See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112 if [[ "$(uname)" == "Darwin" ]]; then # Perform some magic with `& fg` to prevent the processes from turning into a background job. - assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" else # This is not needed on Linux / GitHub Actions - assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc"')" + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEndBash/Fixtures/endtoend.xml.dist tests/EndToEndBash/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEndBash/Fixtures/ClassTwoWithoutStyleError.inc"')" fi }