/** * @param string $hostname * @param string $username * @param integer $port * @return void */ public function showAction($hostname, $username = NULL, $port = NULL) { try { $this->shellService->checkLogin($hostname, $username, $port); $this->view->assign('login', TRUE); } catch (Exception $e) { $this->view->assign('login', FALSE); $this->handleException($e); } }
/** * @test * @return void * @expectedException \Lightwerk\SurfCaptain\Service\Exception */ public function checkLoginThrowsExceptionIfExecuteCommandReturnsExitCode() { $this->shellServiceMock->expects($this->once())->method('executeCommand')->will($this->returnValue(array(1, 'output'))); $this->shellServiceMock->checkLogin('host', 'user'); }