/** * @depends test_doRun * @covers ::getStatus */ public function test_getStatus() { $this->assertTrue($this->Command->open($this->Input), 'ShellCommand::open() should return TRUE'); $this->assertTrue($this->Command->getStatus('running'), 'ShellCommand::getStatus() should return TRUE'); # Invalid arguments try { $this->Command->getStatus(null); $this->fail('Failed to generate exception with invalid arguments'); } catch (InvalidArgumentException $e) { } }
/** * Restarts PhantomJS process. * * @return boolean <code>TRUE</code> on success. <code>FALSE</code> on failure. */ public function phantomRestart() { // Close command $this->_Process->close(); // Wait a bit usleep(100000); // Create bootstrap $Bootstrap = new GenericFile(sys_get_temp_dir() . DIRECTORY_SEPARATOR . md5('PhantomJS') . '.js'); $Bootstrap->putContents(self::BOOTSTRAP); // Open Command $stdIn = ''; $Input = new CommandInput(new StringStream($stdIn)); $Input->Options[] = new Option('config', $this->_ConfigFile); $Input->Arguments[] = new Argument($Bootstrap); // If okay? return true. if ($this->_Process->open($Input)) { return true; } // @codeCoverageIgnoreStart return false; // @codeCoverageIgnoreEnd }