public function testGetOutput() { $result = new Result("str\n"); $this->assertEquals("str\n", $result->getOutput()); }
/** * Tests Cmd::getOutput */ public function testGetOutput() { $result = new Result('echo 1', 0, array('foo', 'bar')); $this->assertEquals(2, count($result->getOutput()), 'output getter should work properly'); }
/** * Handle output based on Environment and Options * @param Result $result Object derived from Result * @return Interpreter */ public function doOutput(Result $result) { $this->debug(__METHOD__, __LINE__); if ($this->environment->isWeb()) { $json = json_encode($result->toArray()); $this->stdout($json); } else { if ($result->hasErrors()) { foreach ($result->getErrors() as $error) { $errstr = $this->outputFormatErrorMessage($error); $this->stderr($errstr); } if ($result->isFail()) { return; } } if ($buffer = trim($result->getOutput())) { $this->stdout($buffer . PHP_EOL); } } }
public function testCanSetOutputUsingString() { $this->result->setOutput('TEST_STRING_OUTPUT'); $this->assertEquals('TEST_STRING_OUTPUT', $this->result->getOutput()); }