File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -872,12 +872,12 @@ private function registerOutOfMemoryShutdownMessage(string $command)
872872 // Allocate all needed memory beforehand as much as possible.
873873 $ errorMsg = PHP_EOL . 'The PHP_CodeSniffer "%1$s" command ran out of memory. ' . PHP_EOL ;
874874 $ errorMsg .= 'Either raise the "memory_limit" of PHP in the php.ini file or raise the memory limit at runtime ' . PHP_EOL ;
875- $ errorMsg .= 'using ` %1$s -d memory_limit=512M` (replace 512M with the desired memory limit). ' . PHP_EOL ;
875+ $ errorMsg .= 'using " %1$s -d memory_limit=512M" (replace 512M with the desired memory limit). ' . PHP_EOL ;
876876 $ errorMsg = sprintf ($ errorMsg , $ command );
877877 $ memoryError = 'Allowed memory size of ' ;
878878 $ errorArray = [
879879 'type ' => 42 ,
880- 'message ' => 'Some random dummy string to take up memory and take up some more memory and some more ' ,
880+ 'message ' => 'Some random dummy string to take up memory and take up some more memory and some more and more and more and more ' ,
881881 'file ' => 'Another random string, which would be a filename this time. Should be relatively long to allow for deeply nested files ' ,
882882 'line ' => 31427 ,
883883 ];
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/; } 2>&1 ) "
9+ assert_exit_code 255
10+
11+ assert_contains " The PHP_CodeSniffer \" phpcs\" command ran out of memory." " $OUTPUT "
12+ assert_contains " Either raise the \" memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" " $OUTPUT "
13+ assert_contains " using \" phpcs -d memory_limit=512M\" (replace 512M with the desired memory limit)." " $OUTPUT "
14+ }
15+
16+ function test_phpcbf_out_of_memory_error_handling() {
17+ OUTPUT=" $( { bin/phpcbf -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ --suffix=.fixed; } 2>&1 ) "
18+ assert_exit_code 255
19+
20+ assert_contains " The PHP_CodeSniffer \" phpcbf\" command ran out of memory." " $OUTPUT "
21+ assert_contains " Either raise the \" memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" " $OUTPUT "
22+ assert_contains " using \" phpcbf -d memory_limit=512M\" (replace 512M with the desired memory limit)." " $OUTPUT "
23+ }
You can’t perform that action at this time.
0 commit comments