You are here

public function SearchApiSolrTest::testExtract in Search API Solr 8

Test tika extension PDF extraction.

File

tests/src/Kernel/SearchApiSolrTest.php, line 905

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

public function testExtract() {
  $filepath = drupal_get_path('module', 'search_api_solr_test') . '/assets/test_extraction.pdf';

  /** @var \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend $backend */
  $backend = Server::load($this->serverId)
    ->getBackend();
  $content = $backend
    ->extractContentFromFile($filepath);
  $this
    ->assertStringContainsString('The extraction seems working!', $content);
}