Skip to content

Instantly share code, notes, and snippets.

@laruence
Created March 28, 2013 05:05
Show Gist options
  • Save laruence/5260811 to your computer and use it in GitHub Desktop.
Save laruence/5260811 to your computer and use it in GitHub Desktop.
php interactive test
$ cat sapi/cli/tests/bug64529.phpt
--TEST--
Bug #64529 (Ran out of opcode space)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test");
if (!file_exists("/usr/bin/expect")) die "skip no expect installed";
?>
--FILE--
<?php
$expect_script = __DIR__ . "/expect.sh";
$php_executable = getenv('TEST_PHP_EXECUTABLE');
system($expect_script . " " . $php_executable);
?>
--EXPECTF--
spawn %sphp -n -a
Interactive mode enabled
echo 'hello world';
echo 'hello world';
$ cat sapi/cli/tests/expect.sh
#!/usr/bin/expect
set php_executable [lindex $argv 0]
spawn $php_executable -n -a
expect "Interactive mode enabled"
send "echo 'hello world';\n"
send "\04"
expect eof
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment