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..fabcf59deba6 --- /dev/null +++ b/ext/readline/tests/readline_cli_completion_readline.phpt @@ -0,0 +1,39 @@ +--TEST-- +Interactive shell: default completion function +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%AInteractive shell%Avariable%Aprecision=3%Afunction%Aconstant%AReadlineCliCompletionClass%Aclass constant%Amethod%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..aebbcc112542 --- /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-- +outside-\n +--EXPECTF-- +%AInteractive shell%Asingle%Adouble%APAREN%A3%Ablock%Acomment%Aattribute%Aoutside-%Ainside%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..79fbe37f7f73 --- /dev/null +++ b/ext/readline/tests/readline_cli_pager.phpt @@ -0,0 +1,22 @@ +--TEST-- +Interactive shell: output through cli.pager +--EXTENSIONS-- +readline +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%Apager output%A diff --git a/ext/readline/tests/readline_cli_prompt.phpt b/ext/readline/tests/readline_cli_prompt.phpt new file mode 100644 index 000000000000..dd46ca362860 --- /dev/null +++ b/ext/readline/tests/readline_cli_prompt.phpt @@ -0,0 +1,25 @@ +--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 \"prompt body\n\";\n"); +fwrite($pipes[0], "}\n"); +fwrite($pipes[0], "quit\n"); +fclose($pipes[0]); +proc_close($proc); +?> +--EXPECTF-- +%AInteractive shell%Aprompt contains unsupported unicode characters%Adyn%Aprompt body%A