You are here

public function SearchApiSolrExtractionTest::testBackend in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/SearchApiSolrExtractionTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrExtractionTest::testBackend()
  2. 4.x tests/src/Kernel/SearchApiSolrExtractionTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrExtractionTest::testBackend()

Test tika extension based PDF extraction.

Overrides BackendTestBase::testBackend

File

tests/src/Kernel/SearchApiSolrExtractionTest.php, line 35

Class

SearchApiSolrExtractionTest
Test tika extension based PDF extraction.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

public function testBackend() {
  $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
    ->assertContains('The extraction seems working!', $content);
}