File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -957,12 +957,12 @@ private function registerOutOfMemoryShutdownMessage($command)
957957 // Allocate all needed memory beforehand as much as possible.
958958 $ errorMsg = PHP_EOL .'The PHP_CodeSniffer "%1$s" command ran out of memory. ' .PHP_EOL ;
959959 $ errorMsg .= 'Either raise the "memory_limit" of PHP in the php.ini file or raise the memory limit at runtime ' .PHP_EOL ;
960- $ errorMsg .= 'using ` %1$s -d memory_limit=512M` (replace 512M with the desired memory limit). ' .PHP_EOL ;
960+ $ errorMsg .= 'using " %1$s -d memory_limit=512M" (replace 512M with the desired memory limit). ' .PHP_EOL ;
961961 $ errorMsg = sprintf ($ errorMsg , $ command );
962962 $ memoryError = 'Allowed memory size of ' ;
963963 $ errorArray = [
964964 'type ' => 42 ,
965- 'message ' => 'Some random dummy string to take up memory and take up some more memory and some more ' ,
965+ 'message ' => 'Some random dummy string to take up memory and take up some more memory and some more and more and more and more ' ,
966966 'file ' => 'Another random string, which would be a filename this time. Should be relatively long to allow for deeply nested files ' ,
967967 'line ' => 31427 ,
968968 ];
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ function tear_down() {
4+ rm -f tests/EndToEnd/Fixtures/* .fixed
5+ }
6+
7+ function test_phpcs_out_of_memory_error_handling() {
8+ 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
12+
13+ assert_contains " The PHP_CodeSniffer \" phpcs\" command ran out of memory." " $OUTPUT "
14+ assert_contains " Either raise the \" memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" " $OUTPUT "
15+ assert_contains " using \" phpcs -d memory_limit=512M\" (replace 512M with the desired memory limit)." " $OUTPUT "
16+ }
17+
18+ function test_phpcbf_out_of_memory_error_handling() {
19+ 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
23+
24+ assert_contains " The PHP_CodeSniffer \" phpcbf\" command ran out of memory." " $OUTPUT "
25+ assert_contains " Either raise the \" memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" " $OUTPUT "
26+ assert_contains " using \" phpcbf -d memory_limit=512M\" (replace 512M with the desired memory limit)." " $OUTPUT "
27+ }
You can’t perform that action at this time.
0 commit comments