/** * Stops the Tika server * * @return void */ public function stopServerAction() { $this->tikaService->stopServer(); // give it some time to stop sleep(2); if (!$this->tikaService->isServerRunning()) { $this->addFlashMessage('Tika server stopped.', FlashMessage::OK); } $this->forwardToIndex(); }
/** * @test */ public function stopServerRemovesPidFromRegistry() { // prepare $registryMock = $this->prophet->prophesize('TYPO3\\CMS\\Core\\Registry'); $registryMock->get('tx_tika', 'server.pid')->willReturn(1000); $registryMock->remove('tx_tika', 'server.pid')->shouldBeCalled(); GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Registry', $registryMock->reveal()); $processMock = $this->prophet->prophesize('ApacheSolrForTypo3\\Tika\\Process'); $processMock->setPid(1000)->shouldBeCalled(); $processMock->stop()->shouldBeCalled(); GeneralUtility::addInstance('ApacheSolrForTypo3\\Tika\\Process', $processMock->reveal()); // execute $service = new ServerService($this->getConfiguration()); $service->stopServer(); }