diff --git a/ext/readline/tests/readline_cli_auto_prepend.phpt b/ext/readline/tests/readline_cli_auto_prepend.phpt new file mode 100644 index 000000000000..71d4477a7cde --- /dev/null +++ b/ext/readline/tests/readline_cli_auto_prepend.phpt @@ -0,0 +1,30 @@ +--TEST-- +Interactive shell: auto_prepend_file is executed before input +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + []); +PHP); + +$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); +$ini = getenv('TEST_PHP_EXTRA_ARGS'); +$descriptorspec = [['pipe', 'r'], STDOUT, STDERR]; +$proc = proc_open("$php $ini -d auto_prepend_file=" . escapeshellarg($prepend) . " -a", $descriptorspec, $pipes); +fwrite($pipes[0], "echo READLINE_CLI_PREPENDED . \"\n\";\n"); +fwrite($pipes[0], "exit\n"); +fclose($pipes[0]); +proc_close($proc); +unlink($prepend); +?> +--EXPECTF-- +%AInteractive shell%Aprepended%Aok%A diff --git a/ext/readline/tests/readline_cli_completion_readline.phpt b/ext/readline/tests/readline_cli_completion_readline.phpt new file mode 100644 index 000000000000..cd4cbe148346 --- /dev/null +++ b/ext/readline/tests/readline_cli_completion_readline.phpt @@ -0,0 +1,37 @@ +--TEST-- +Interactive shell: default completion function +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%AInteractive shell%Avariable_ok%Aprecision_result=3%Afunction_ok%Aconstant_ok%Aclass_ok:ReadlineCliCompletionClass%Amethod_ok%A diff --git a/ext/readline/tests/readline_cli_long_input.phpt b/ext/readline/tests/readline_cli_long_input.phpt new file mode 100644 index 000000000000..a74850aef2d4 --- /dev/null +++ b/ext/readline/tests/readline_cli_long_input.phpt @@ -0,0 +1,22 @@ +--TEST-- +Interactive shell: input buffer grows for long lines +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%AInteractive shell%A5000%A diff --git a/ext/readline/tests/readline_cli_multiline_states.phpt b/ext/readline/tests/readline_cli_multiline_states.phpt new file mode 100644 index 000000000000..1aaea49ac963 --- /dev/null +++ b/ext/readline/tests/readline_cli_multiline_states.phpt @@ -0,0 +1,33 @@ +--TEST-- +Interactive shell: multiline input states +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- +getAttributes()[0]->getName()), \"\\n\";\n"); +fwrite($pipes[0], "if (true) ?>outside } );\n +--EXPECTF-- +%AInteractive shell%ASINGLE%ADOUBLE%APAREN%Aarithmetic=103%ABLOCK_BODY%AHASH_COMMENT%ASLASH_COMMENT%ABLOCK_COMMENT%AALLOWDYNAMICPROPERTIES%AOUTSIDE_OK%A diff --git a/ext/readline/tests/readline_cli_pager.phpt b/ext/readline/tests/readline_cli_pager.phpt new file mode 100644 index 000000000000..2d5309472324 --- /dev/null +++ b/ext/readline/tests/readline_cli_pager.phpt @@ -0,0 +1,29 @@ +--TEST-- +Interactive shell: output through cli.pager +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Interactive shell + +php > echo "pager output +php " "; +pager output +PAGER OUTPUT +php > quit diff --git a/ext/readline/tests/readline_cli_prompt.phpt b/ext/readline/tests/readline_cli_prompt.phpt new file mode 100644 index 000000000000..ddb5296cf943 --- /dev/null +++ b/ext/readline/tests/readline_cli_prompt.phpt @@ -0,0 +1,43 @@ +--TEST-- +Interactive shell: custom prompt escape sequences +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- +-\`-\q-' . "\xC3\xA9\xC3\xA9" . '-`echo \'dyn\';`-`-x '; +$descriptorspec = [['pipe', 'r'], STDOUT, STDERR]; +$proc = proc_open("$php $ini -d " . escapeshellarg("cli.prompt=\"$prompt\"") . " -a", $descriptorspec, $pipes); +fwrite($pipes[0], "if (true) {\n"); +fwrite($pipes[0], "echo strtoupper(\"prompt_body\\n\");\n"); +fwrite($pipes[0], "}\n"); +fwrite($pipes[0], "quit\n"); +fclose($pipes[0]); +proc_close($proc); +?> +--EXPECTF-- +Interactive shell + + +Warning: prompt contains unsupported unicode characters in Unknown on line 0 +dynpre\- +- -%c-%d.%d.%s-php->-`-\q-????-dyn--x if (true) { + +Warning: prompt contains unsupported unicode characters in Unknown on line 0 +dynpre\- +- -%c-%d.%d.%s-php-{-`-\q-????-dyn--x echo strtoupper("prompt_body\n"); + +Warning: prompt contains unsupported unicode characters in Unknown on line 0 +dynpre\- +- -%c-%d.%d.%s-php-{-`-\q-????-dyn--x } + +Warning: prompt contains unsupported unicode characters in Unknown on line 0 +dynPROMPT_BODY +pre\- +- -%c-%d.%d.%s-php->-`-\q-????-dyn--x quit