Skip to content

Commit

Permalink
fix code style in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekstazi committed Jun 19, 2019
1 parent 7920bbf commit b737014
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions tests/ShellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,30 @@ public function testShellEnv() {
});
}

public function testStdInZero() {
Loop::run(function () {

$sshResource = yield $this->getSsh();

$shell = new \Amp\Ssh\Shell($sshResource);
yield $shell->start();


\Amp\asyncCall(function () use ($shell) {
yield $shell->join();
});

// read greeting from server
while ($chunk = yield $shell->getStdout()->read()) {
if(strpos($chunk, ':~#') !== false) {
break;
}
}
// enter 1 in terminal
yield $shell->getStdin()->write(1);
$this->assertEquals(1, yield $shell->getStdout()->read());
// try enter 0
yield $shell->getStdin()->write(0);
$this->assertEquals(0, yield \Amp\Promise\timeout($shell->getStdout()->read(), 1));
});
}
public function testStdInZero() {
Loop::run(function () {
$sshResource = yield $this->getSsh();

$shell = new \Amp\Ssh\Shell($sshResource);
yield $shell->start();


\Amp\asyncCall(function () use ($shell) {
yield $shell->join();
});

// read greeting from server
while ($chunk = yield $shell->getStdout()->read()) {
if (\strpos($chunk, ':~#') !== false) {
break;
}
}
// enter 1 in terminal
yield $shell->getStdin()->write(1);
$this->assertEquals(1, yield $shell->getStdout()->read());
// try enter 0
yield $shell->getStdin()->write(0);
$this->assertEquals(0, yield \Amp\Promise\timeout($shell->getStdout()->read(), 1));
});
}
}

0 comments on commit b737014

Please sign in to comment.