[pecl-networking-ssh2] master: Make these tests care less about server shell output (motd, terminal escape sequences etc)
| From: | Casper Langemeijer | Date: | Fri, 16 Oct 2026 20:24:59 +0000 |
| Subject: | [pecl-networking-ssh2] master: Make these tests care less about server shell output (motd, terminal escape sequences etc) | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-28706@lists.php.net to get a copy of this message | ||
Author: Casper Langemeijer (langemeijer)
Date: 2026-10-16T22:20:59+02:00
Commit: https://github.com/php/pecl-networking-ssh2/commit/8787b5fad303ed7fff5da606dfe5804dcc75ffff
Raw diff: https://github.com/php/pecl-networking-ssh2/commit/8787b5fad303ed7fff5da606dfe5804dcc75ffff.diff
Make these tests care less about server shell output (motd, terminal escape sequences etc)
Changed paths:
M tests/ssh2_shell.phpt
M tests/ssh2_stream_select.phpt
Diff:
diff --git a/tests/ssh2_shell.phpt b/tests/ssh2_shell.phpt
index dc5c18e..ad95241 100644
--- a/tests/ssh2_shell.phpt
+++ b/tests/ssh2_shell.phpt
@@ -12,13 +12,15 @@ var_dump($shell);
fwrite( $shell, 'echo "foo bar"'.PHP_EOL);
sleep(1);
+$found = false;
while($line = fgets($shell)) {
- echo $line;
+ if (str_contains($line, 'foo bar') && !str_contains($line, 'echo'))
{
+ $found = true;
+ }
}
+var_dump($found);
--EXPECTF--
bool(true)
resource(%d) of type (stream)
-%a
-foo bar
-%a
\ No newline at end of file
+bool(true)
\ No newline at end of file
diff --git a/tests/ssh2_stream_select.phpt b/tests/ssh2_stream_select.phpt
index 824b409..e3f8d1b 100644
--- a/tests/ssh2_stream_select.phpt
+++ b/tests/ssh2_stream_select.phpt
@@ -18,19 +18,21 @@ $write = null;
$except = null;
$timeout = 5;
$start = time();
+$found = false;
if (stream_select($read, $write, $except, $timeout) !== false && count($read) > 0) {
while($line = fgets($shell)) {
- echo $line;
+ if (str_contains($line, 'howdy') && !str_contains($line, 'echo'))
{
+ $found = true;
+ }
}
}
+var_dump($found);
+
$elapsed = time() - $start;
var_dump(($elapsed < $timeout));
--EXPECTF--
bool(true)
resource(%d) of type (stream)
-%a
-%a
-%a
-howdy
-%sbool(true)
\ No newline at end of file
+bool(true)
+bool(true)
\ No newline at end of file