/** * Starts the Tika server * * @return void */ public function startServerAction() { $this->tikaService->startServer(); // give it some time to start sleep(2); if ($this->tikaService->isServerRunning()) { $this->addFlashMessage('Tika server started.', FlashMessage::OK); } $this->forwardToIndex(); }
/** * @test */ public function startServerStoresPidInRegistry() { // prepare $registryMock = $this->prophet->prophesize('TYPO3\\CMS\\Core\\Registry'); GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Registry', $registryMock->reveal()); $processMock = $this->prophet->prophesize('ApacheSolrForTypo3\\Tika\\Process'); $processMock->start()->shouldBeCalled(); $processMock->getPid()->willReturn(1000); GeneralUtility::addInstance('ApacheSolrForTypo3\\Tika\\Process', $processMock->reveal()); // execute $service = new ServerService($this->getConfiguration()); $service->startServer(); // test $registryMock->set('tx_tika', 'server.pid', Argument::that(function ($arg) { return is_int($arg) && $arg == 1000; }))->shouldHaveBeenCalled(); }