/**
  * Checks whether the configured Tika server can be reached and provides a
  * flash message according to the result of the check.
  *
  * @return void
  */
 protected function checkTikaServerConnection()
 {
     if ($this->tikaService->ping()) {
         $this->addFlashMessage('Tika host contacted at: ' . $this->tikaService->getTikaServerUrl(), 'Your Apache Tika server has been contacted.', FlashMessage::OK);
     } else {
         $this->addFlashMessage('Could not connect ot Tika at: ' . $this->tikaService->getTikaServerUrl(), 'Unable to contact your Apache Tika server.', FlashMessage::ERROR);
     }
 }
Exemplo n.º 2
0
 /**
  * @test
  */
 public function getTikaUrlBuildsUrlFromConfiguration()
 {
     $service = new ServerService($this->getConfiguration());
     $this->assertEquals('http://localhost:9998', $service->getTikaServerUrl());
 }
Exemplo n.º 3
0
 /**
  * @test
  * @dataProvider languageFileDataProvider
  */
 public function detectsLanguageFromString($language)
 {
     $service = new ServerService($this->getTikaServerConfiguration());
     $file = $this->testLanguagesPath . $language . '.test';
     $languageString = file_get_contents($file);
     $detectedLanguage = $service->detectLanguageFromString($languageString);
     $this->assertSame($language, $detectedLanguage);
 }
Exemplo n.º 4
0
 /**
  * @test
  */
 public function extractsTextFromDocFile()
 {
     $this->markTestIncomplete();
     $service = new ServerService($this->getTikaServerConfiguration());
     $expectedText = 'Sample Word Document';
     $extractedText = $service->extractText();
     $this->assertContains($expectedText, $extractedText);
 }