|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +function tear_down() { |
| 4 | + rm -f tests/EndToEnd/Fixtures/*.fixed |
| 5 | +} |
| 6 | + |
| 7 | +function test_phpcs_exit_code_clean_file() { |
| 8 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc |
| 9 | + assert_exit_code 0 |
| 10 | +} |
| 11 | +function test_phpcs_exit_code_clean_stdin() { |
| 12 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc |
| 13 | + assert_exit_code 0 |
| 14 | +} |
| 15 | +function test_phpcbf_exit_code_clean_file() { |
| 16 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc |
| 17 | + assert_exit_code 0 |
| 18 | +} |
| 19 | +function test_phpcbf_exit_code_clean_stdin() { |
| 20 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc |
| 21 | + assert_exit_code 0 |
| 22 | +} |
| 23 | + |
| 24 | +function test_phpcs_exit_code_fixable_file() { |
| 25 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc |
| 26 | + assert_exit_code 1 |
| 27 | +} |
| 28 | +function test_phpcs_exit_code_fixable_stdin() { |
| 29 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithStyleError.inc |
| 30 | + assert_exit_code 1 |
| 31 | +} |
| 32 | +function test_phpcbf_exit_code_fixable_file() { |
| 33 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc |
| 34 | + assert_exit_code 0 |
| 35 | +} |
| 36 | +function test_phpcbf_exit_code_fixable_stdin() { |
| 37 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithStyleError.inc |
| 38 | + assert_exit_code 0 |
| 39 | +} |
| 40 | + |
| 41 | +function test_phpcs_exit_code_non_fixable_file() { |
| 42 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc |
| 43 | + assert_exit_code 2 |
| 44 | +} |
| 45 | +function test_phpcs_exit_code_non_fixable_stdin() { |
| 46 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc |
| 47 | + assert_exit_code 2 |
| 48 | +} |
| 49 | +function test_phpcbf_exit_code_non_fixable_file() { |
| 50 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc |
| 51 | + assert_exit_code 2 |
| 52 | +} |
| 53 | +function test_phpcbf_exit_code_non_fixable_stdin() { |
| 54 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithUnfixableStyleError.inc |
| 55 | + assert_exit_code 2 |
| 56 | +} |
| 57 | + |
| 58 | +function test_phpcs_exit_code_fixable_and_non_fixable_file() { |
| 59 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc |
| 60 | + assert_exit_code 3 |
| 61 | +} |
| 62 | +function test_phpcs_exit_code_fixable_and_non_fixable_stdin() { |
| 63 | + bin/phpcs --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc |
| 64 | + assert_exit_code 3 |
| 65 | +} |
| 66 | +function test_phpcbf_exit_code_fixable_and_non_fixable_file() { |
| 67 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc |
| 68 | + assert_exit_code 2 |
| 69 | +} |
| 70 | +function test_phpcbf_exit_code_fixable_and_non_fixable_stdin() { |
| 71 | + bin/phpcbf --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist < tests/EndToEnd/Fixtures/ClassWithTwoStyleErrors.inc |
| 72 | + assert_exit_code 2 |
| 73 | +} |
0 commit comments