Skip to content

Commit af1b003

Browse files
authored
Merge pull request #1301 from PHPCSStandards/feature/e2e-tests-use-new-bashunit-feature
E2E tests: use new bashunit assertion
2 parents a82bffd + cf28362 commit af1b003

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ To run the tests specific to the use of `PHP_CODESNIFFER_CBF === true`:
391391

392392
### Writing End-to-End Tests
393393

394-
Bash-based end-to-end tests can be written using the [Bashunit](https://bashunit.typeddevs.com/) test tooling.
394+
Bash-based end-to-end tests can be written using the [Bashunit](https://bashunit.typeddevs.com/) test tooling using version 0.26.0 or higher.
395395

396396
To install bashunit, follow the [installation guide](https://bashunit.typeddevs.com/installation).
397397

tests/EndToEnd/outofmemory_test.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ function tear_down() {
66

77
function test_phpcs_out_of_memory_error_handling() {
88
OUTPUT="$(bin/phpcs -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/)"
9-
# Exit code can't currently be tested as it looks like it may be 255 or 139 depending on the PHP version.
10-
# Related feature request upstream: https://github.com/TypedDevs/bashunit/issues/505
11-
# assert_exit_code 255
9+
# Exit code may be 255 or 139 depending on the PHP version, but the exact code is not our concern, just that it's non-zero.
10+
assert_unsuccessful_code
1211

1312
assert_contains "The PHP_CodeSniffer \"phpcs\" command ran out of memory." "$OUTPUT"
1413
assert_contains "Either raise the \"memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" "$OUTPUT"
@@ -17,9 +16,8 @@ function test_phpcs_out_of_memory_error_handling() {
1716

1817
function test_phpcbf_out_of_memory_error_handling() {
1918
OUTPUT="$(bin/phpcbf -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ --suffix=.fixed)"
20-
# Exit code can't currently be tested as it looks like it may be 255 or 139 depending on the PHP version.
21-
# Related feature request upstream: https://github.com/TypedDevs/bashunit/issues/505
22-
# assert_exit_code 255
19+
# Exit code may be 255 or 139 depending on the PHP version, but the exact code is not our concern, just that it's non-zero.
20+
assert_unsuccessful_code
2321

2422
assert_contains "The PHP_CodeSniffer \"phpcbf\" command ran out of memory." "$OUTPUT"
2523
assert_contains "Either raise the \"memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" "$OUTPUT"

0 commit comments

Comments
 (0)